small class holding a stringstream
More...
small class holding a stringstream
try{
throw Error(
Message(
_ping_)<<
"This is error number "<<number);}
catch( Error& m) {std::cerr << m.what();}
Message()
construct an empty message
Definition: exceptions.h:36
#define _ping_
Definition: exceptions.h:12
◆ Message() [1/3]
construct an empty message
◆ Message() [2/3]
dg::Message::Message |
( |
const char * |
file, |
|
|
const int |
line |
|
) |
| |
|
inline |
Initiate message with the file and line it comes from.
- Parameters
-
file | The file in which the exception is thrown (contained in the predefined Macro __FILE__ ) |
line | The line in which the exception is thrown (contained in the predefined Macro __LINE__ ) |
- Note
- The Macro
_ping_
expands to __FILE__, __LINE__
_
◆ Message() [3/3]
dg::Message::Message |
( |
std::string |
m | ) |
|
|
inline |
Construct message with string.
- Parameters
-
◆ ~Message()
dg::Message::~Message |
( |
| ) |
|
|
inline |
◆ operator<<()
template<class T >
Message & dg::Message::operator<< |
( |
const T & |
value | ) |
|
|
inline |
add values to the message stream
- Note
- you can't use
std::endl
or std::flush
in here
◆ str()
std::string dg::Message::str |
( |
| ) |
const |
|
inline |
return the message contained in the stream as a string
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const Message & |
m |
|
) |
| |
|
friend |
put the sringstream string into the ostream
- Note
- same as os<<m.str();
The documentation for this class was generated from the following file: