#include <mimasexception.h>
Inheritance diagram for mimas::mimasexception:
Public Member Functions | |
mimasexception (void) | |
Constructor. | |
mimasexception (mimasexception &e) | |
Copy constructor. | |
virtual | ~mimasexception (void) throw () |
Destructor. | |
template<typename T> | |
std::ostream & | operator<< (const T &t) |
std::ostream & | operator<< (std::ostream &(*__pf)(std::ostream &)) |
Interface for manipulators. | |
virtual const char * | what (void) const throw () |
Returns error message (not thread safe). | |
Protected Attributes | |
std::ostringstream | message |
Memory-stream containing the error message. | |
Static Protected Attributes | |
static std::string | temp |
Temporary to do null-termination. |
This class provides a syntax similar to output-streams for convenience. For compability with other libraries it is inheriting the class std::exception
.
Here is an example how to use an instance of this class (by invoking the macro MMERROR):
void test( int i ) throw (exception) { MMERROR( i > 0, exception, , "Parameter for method test must be greater than zero (but was " << i << ")." ); } int main(void) { try { test( -5 ); } catch ( exception &e ) { cerr << e.what() << endl; }; return 0; }
_e
. Make sure, that you don't use this variable-name in any of the macro-arguments!
Definition at line 40 of file mimasexception.h.
mimas::mimasexception::mimasexception | ( | void | ) | [inline] |
mimas::mimasexception::mimasexception | ( | mimasexception & | e | ) | [inline] |
virtual mimas::mimasexception::~mimasexception | ( | void | ) | throw () [inline, virtual] |
std::ostream& mimas::mimasexception::operator<< | ( | const T & | t | ) | [inline] |
std::ostream& mimas::mimasexception::operator<< | ( | std::ostream &(*)(std::ostream &) | __pf | ) | [inline] |
Interface for manipulators.
Manipulators such as std::endl
and std::hex
use these functions in constructs like "mimasexception e; e << std::endl". For more information, see the iomanip header.
Definition at line 57 of file mimasexception.h.
References message.
virtual const char* mimas::mimasexception::what | ( | void | ) | const throw () [inline, virtual] |
std::ostringstream mimas::mimasexception::message [protected] |
Memory-stream containing the error message.
Definition at line 66 of file mimasexception.h.
Referenced by mimasexception(), operator<<(), and what().
std::string mimas::mimasexception::temp [static, protected] |
Temporary to do null-termination.
The method what()
requires a null-terminated string.
Definition at line 69 of file mimasexception.h.
Referenced by what().