|
stator
A math, geometry, and utility library
|
An exception class that also appears to function like an ostream object. More...
#include <exception.hpp>
Public Member Functions | |
| Exception (int line, const char *file, const char *funcname) throw () | |
| Constructor called by the stator_throw() macro. More... | |
| Exception (const Exception &e) | |
| Copy constructor. More... | |
| ~Exception () throw () | |
| template<class T > | |
| Exception & | operator<< (const T &m) |
| The stream operator engine for the class. More... | |
| const char * | what () const throw () |
| Get the stored message from the class. More... | |
This class is thrown using the stator_throw() macro like so :-
An important note, you should always catch the exception classes by reference, as this prevents type conversions to base classes and maintains the virtual overrides.
Please note, as the stator::Exception class inherits from std::exception, you can catch it using a more generic catch statement
To allow the combining of multiple exception types, all exceptions should inherit virtually from base exception types.
Definition at line 66 of file exception.hpp.
|
inline | ||||||||||||||||||||||||
| line | The line number in the source file. |
| file | The name of the source file. |
| funcname | The name of the function throwing the exception. |
Definition at line 74 of file exception.hpp.
|
inline |
Please catch exceptions by reference, they should not be copied except at the throw site.
Definition at line 86 of file exception.hpp.
|
inline | |||||||||||||
Definition at line 89 of file exception.hpp.
|
inline |
Definition at line 94 of file exception.hpp.
|
inline | |||||||||||||
This returns a pointer to a traditional C-type string. This is guaranteed to be valid at least until the exception object from which it is obtained is destroyed or until a non-const member function of the exception object is called.
This is not reentrant and is annoyingly C-like, but it is in the standard.
Definition at line 109 of file exception.hpp.
1.8.13