gcn::Exception Class Reference

#include <exception.hpp>

List of all members.


Detailed Description

An exception containing a message, a file and a line number.

Guichan will only throw exceptions of this class. You can use this class for your own exceptions. A nifty feature of the excpetion class is that it can tell you from which line and file it was thrown. To make things easier when throwing exceptions there exists a macro for creating exceptions which automatically sets the filename and line number.

EXAMPLE:

          throw GCN_EXCEPTION("my error message");

Definition at line 98 of file exception.hpp.

Public Member Functions

 Exception ()
 Constructor.
 Exception (const std::string &message)
 Constructor.
 Exception (const std::string &message, const std::string &function, const std::string &filename, int line)
 Constructor.
const std::string & getFunction () const
 Gets the function name in which the exception was thrown.
const std::string & getMessage () const
 Gets the error message of the exception.
const std::string & getFilename () const
 Gets the filename in which the exceptions was thrown.
int getLine () const
 Gets the line number of the line where the exception was thrown.

Protected Attributes

std::string mFunction
std::string mMessage
std::string mFilename
int mLine


Constructor & Destructor Documentation

gcn::Exception::Exception ( const std::string &  message  ) 

Constructor.

Parameters:
message the error message.

Definition at line 70 of file exception.cpp.

References mMessage.

gcn::Exception::Exception ( const std::string &  message,
const std::string &  function,
const std::string &  filename,
int  line 
)

Constructor.

NOTE: Don't use this constructor. Use the GCN_EXCEPTION macro instead.

Parameters:
message the error message.
function the function name.
filename the name of the file.
line the line number.

Definition at line 75 of file exception.cpp.

References mFilename, mFunction, mLine, and mMessage.


Member Function Documentation

const std::string & gcn::Exception::getFilename (  )  const

Gets the filename in which the exceptions was thrown.

Returns:
the filename in which the exception was thrown.

Definition at line 96 of file exception.cpp.

References mFilename.

const std::string & gcn::Exception::getFunction (  )  const

Gets the function name in which the exception was thrown.

Returns:
the function name in which the exception was thrown.

Definition at line 86 of file exception.cpp.

References mFunction.

int gcn::Exception::getLine (  )  const

Gets the line number of the line where the exception was thrown.

Returns:
the line number of the line where the exception was thrown.

Definition at line 101 of file exception.cpp.

References mLine.

const std::string & gcn::Exception::getMessage (  )  const

Gets the error message of the exception.

Returns:
the error message.

Definition at line 91 of file exception.cpp.

References mMessage.


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:48 2006 for Guichan by  doxygen 1.4.7