#include <exception.h>
Public Member Functions | |
Exception (const Exception &rhs) | |
Copy constructor. | |
Exception (int number, const Object &object, const std::string &description, const std::string &source, const char *type, const char *file, long line) | |
Advanced constructor. | |
Exception (int number, const Object &object, const std::string &description, const std::string &source) | |
Default constructor. | |
virtual const std::string & | getDescription () const |
Returns a string with only the 'description' field of this exception. | |
virtual const std::string & | getFile () const |
gets source file name. | |
virtual const std::string & | getFullDescription () const |
Returns a string with the full description of this error. | |
virtual long | getLine () const |
gets line number. | |
virtual int | getNumber () const throw () |
gets the error code. | |
virtual const std::string & | getSource () const |
gets the source function. | |
void | operator= (const Exception &rhs) |
Assignment operator. | |
const char * | what () const throw () |
Override std::exception::what. | |
~Exception () throw () | |
Needed for compatibility with std::exception. | |
Protected Attributes | |
std::string | mDescription |
std::string | mFile |
std::string | mFullDesc |
long | mLine |
int | mNumber |
const Object * | mObject |
std::string | mSource |
std::string | mTypeName |
Definition at line 87 of file exception.h.
gpucalc::Exception::Exception | ( | int | number, | |
const Object & | object, | |||
const std::string & | description, | |||
const std::string & | source | |||
) |
Default constructor.
Definition at line 44 of file exception.cpp.
00044 : 00045 mLine(0), mObject(&object), mNumber(num), mDescription(desc), mSource(src) 00046 { 00047 // Log this error - not any more, allow catchers to do it 00048 //LogManager::getSingleton().logMessage(this->getFullDescription()); 00049 }
gpucalc::Exception::Exception | ( | int | number, | |
const Object & | object, | |||
const std::string & | description, | |||
const std::string & | source, | |||
const char * | type, | |||
const char * | file, | |||
long | line | |||
) |
Advanced constructor.
Definition at line 52 of file exception.cpp.
00052 : 00053 mLine(lin), mObject(&object), mNumber(num), mTypeName(typ), mDescription(desc), mSource(src), mFile(fil) 00054 { 00055 // Log this error, mask it from debug though since it may be caught and ignored 00056 if (LogManager::getSingletonPtr()) 00057 { 00058 LogManager::getSingleton().logMessage(mObject, this->getFullDescription(), LML_Critical, true); 00059 } 00060 }
gpucalc::Exception::Exception | ( | const Exception & | rhs | ) |
Copy constructor.
Definition at line 63 of file exception.cpp.
00063 : std::exception(), mLine(rhs.mLine), mObject(rhs.mObject), 00064 mNumber(rhs.mNumber), mDescription(rhs.mDescription), mSource(rhs.mSource), mFile(rhs.mFile) 00065 { 00066 }
gpucalc::Exception::~Exception | ( | ) | throw () [inline] |
virtual const std::string& gpucalc::Exception::getDescription | ( | ) | const [inline, virtual] |
Returns a string with only the 'description' field of this exception.
Use getFullDescription() to get a full description of the error including line number, error number and what function threw the exception.
Definition at line 190 of file exception.h.
00191 { 00192 return mDescription; 00193 }
virtual const std::string& gpucalc::Exception::getFile | ( | ) | const [inline, virtual] |
gets source file name.
Definition at line 169 of file exception.h.
00170 { 00171 return mFile; 00172 }
const std::string & gpucalc::Exception::getFullDescription | ( | ) | const [virtual] |
Returns a string with the full description of this error.
Definition at line 81 of file exception.cpp.
00082 { 00083 if (mFullDesc.empty()) 00084 { 00085 std::ostringstream desc; 00086 desc << "EXCEPTION(" << mNumber << ":" << mTypeName << "): " 00087 << mDescription << " in " << mSource; 00088 00089 if (mLine > 0) 00090 { 00091 desc << " at " << mFile << " (line " << mLine << ")"; 00092 } 00093 mFullDesc = desc.str(); 00094 } 00095 return mFullDesc; 00096 }
virtual long gpucalc::Exception::getLine | ( | ) | const [inline, virtual] |
int gpucalc::Exception::getNumber | ( | ) | const throw () [virtual] |
gets the error code.
Definition at line 99 of file exception.cpp.
00100 { 00101 return mNumber; 00102 }
virtual const std::string& gpucalc::Exception::getSource | ( | ) | const [inline, virtual] |
gets the source function.
Definition at line 160 of file exception.h.
00161 { 00162 return mSource; 00163 }
void gpucalc::Exception::operator= | ( | const Exception & | rhs | ) |
Assignment operator.
Definition at line 69 of file exception.cpp.
00070 { 00071 mDescription = rhs.mDescription; 00072 mNumber = rhs.mNumber; 00073 mSource = rhs.mSource; 00074 mFile = rhs.mFile; 00075 mLine = rhs.mLine; 00076 mObject = rhs.mObject; 00077 mTypeName = rhs.mTypeName; 00078 }
const char* gpucalc::Exception::what | ( | ) | const throw () [inline] |
Override std::exception::what.
Definition at line 199 of file exception.h.
00200 { 00201 return getFullDescription().c_str(); 00202 }
std::string gpucalc::Exception::mDescription [protected] |
Definition at line 94 of file exception.h.
std::string gpucalc::Exception::mFile [protected] |
Definition at line 96 of file exception.h.
std::string gpucalc::Exception::mFullDesc [mutable, protected] |
Definition at line 97 of file exception.h.
long gpucalc::Exception::mLine [protected] |
Definition at line 90 of file exception.h.
int gpucalc::Exception::mNumber [protected] |
Definition at line 92 of file exception.h.
const Object* gpucalc::Exception::mObject [protected] |
Definition at line 91 of file exception.h.
std::string gpucalc::Exception::mSource [protected] |
Definition at line 95 of file exception.h.
std::string gpucalc::Exception::mTypeName [protected] |
Definition at line 93 of file exception.h.