Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

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 94 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 68 of file exception.cpp.

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 73 of file exception.cpp.


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 94 of file exception.cpp.

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 84 of file exception.cpp.

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 99 of file exception.cpp.

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

Gets the error message of the exception.

Returns:
the error message.

Definition at line 89 of file exception.cpp.


The documentation for this class was generated from the following files:
Generated on Tue May 17 21:23:26 2005 for Guichan by  doxygen 1.4.1