JWS C++ Library
C++ language utility library
|
Base class of all exceptions in the jwsc++ library. More...
#include <exception.h>
Public Member Functions | |
Exception (const char *msg, const char *file=0, uint32_t line=0) | |
Constructs an Exception. | |
Exception (const string &msg, const char *file=0, uint32_t line=0) | |
Constructs an Exception. | |
Exception (const Exception &e) | |
Constructs an Exception from another. | |
virtual | ~Exception () |
Deletes an Exception. | |
const string & | get_msg () const |
Returns the error message for the Exception. | |
const char * | get_file () const |
Returns the file name where the Exception occurred. | |
uint32_t | get_line () const |
Returns the line number near where the Exception occurred. | |
virtual void | print (ostream &out=cerr, bool newline=true) const |
Prints the Exception::msg to an ostream. | |
virtual void | print_details (ostream &out=cerr, bool newline=true) const |
Prints all the fields of the Exception to an ostream. | |
virtual void | print_abort (ostream &out=cerr, bool newline=true) const |
Prints the Exception::msg to an ostream and aborts. | |
virtual void | print_details_abort (ostream &out=cerr, bool newline=true) const |
Prints all the fields of the Exception to an ostream and aborts. | |
virtual void | print_exit (ostream &out=cerr, bool newline=true, int status=EXIT_FAILURE) const |
Prints the Exception::msg to an ostream and exits. | |
virtual void | print_details_exit (ostream &out=cerr, bool newline=true, int status=EXIT_FAILURE) const |
Prints all the fields of the Exception to an ostream and exits. | |
Protected Attributes | |
string | msg |
Message associated with the error causing the exception. | |
const char * | file |
File name where the Error occurred. | |
uint32_t | line |
Line number where the Error occurred. |
Base class of all exceptions in the jwsc++ library.
Definition at line 74 of file exception.h.
Exception::Exception | ( | const char * | msg, |
const char * | file = 0 , |
||
uint32_t | line = 0 |
||
) |
Constructs an Exception.
msg | Error message. |
file | File where the error occurred. |
line | Line approximately where the error occurred. |
Definition at line 77 of file exception.cpp.
Exception::Exception | ( | const string & | msg, |
const char * | file = 0 , |
||
uint32_t | line = 0 |
||
) |
Constructs an Exception.
msg | Error message. |
file | File where the error occurred. |
line | Line approximately where the error occurred. |
Definition at line 90 of file exception.cpp.
Exception::Exception | ( | const Exception & | e | ) |
Constructs an Exception from another.
e | Exception to copy into this one. |
Definition at line 99 of file exception.cpp.
virtual jwscxx::base::Exception::~Exception | ( | ) | [inline, virtual] |
Deletes an Exception.
Definition at line 91 of file exception.h.
const string& jwscxx::base::Exception::get_msg | ( | ) | const [inline] |
Returns the error message for the Exception.
Definition at line 95 of file exception.h.
const char* jwscxx::base::Exception::get_file | ( | ) | const [inline] |
Returns the file name where the Exception occurred.
Definition at line 99 of file exception.h.
uint32_t jwscxx::base::Exception::get_line | ( | ) | const [inline] |
Returns the line number near where the Exception occurred.
Definition at line 103 of file exception.h.
void Exception::print | ( | ostream & | out = cerr , |
bool | newline = true |
||
) | const [virtual] |
Prints the Exception::msg to an ostream.
out | Output stream to print to. |
newline | Whether to print a newline character. |
Definition at line 111 of file exception.cpp.
void Exception::print_details | ( | ostream & | out = cerr , |
bool | newline = true |
||
) | const [virtual] |
Prints all the fields of the Exception to an ostream.
out | Output stream to print to. |
newline | Whether to print a newline character. |
Definition at line 123 of file exception.cpp.
void Exception::print_abort | ( | ostream & | out = cerr , |
bool | newline = true |
||
) | const [virtual] |
Prints the Exception::msg to an ostream and aborts.
out | Output stream to print to. |
newline | Whether to print a newline character. |
Definition at line 146 of file exception.cpp.
void Exception::print_details_abort | ( | ostream & | out = cerr , |
bool | newline = true |
||
) | const [virtual] |
Prints all the fields of the Exception to an ostream and aborts.
out | Output stream to print to. |
newline | Whether to print a newline character. |
Definition at line 157 of file exception.cpp.
void Exception::print_exit | ( | ostream & | out = cerr , |
bool | newline = true , |
||
int | status = EXIT_FAILURE |
||
) | const [virtual] |
Prints the Exception::msg to an ostream and exits.
out | Output stream to print to. |
newline | Whether to print a newline character. |
status | Exit status. |
Definition at line 169 of file exception.cpp.
void Exception::print_details_exit | ( | ostream & | out = cerr , |
bool | newline = true , |
||
int | status = EXIT_FAILURE |
||
) | const [virtual] |
Prints all the fields of the Exception to an ostream and exits.
out | Output stream to print to. |
newline | Whether to print a newline character. |
status | Exit status. |
Definition at line 181 of file exception.cpp.
string jwscxx::base::Exception::msg [protected] |
Message associated with the error causing the exception.
Definition at line 156 of file exception.h.
const char* jwscxx::base::Exception::file [protected] |
File name where the Error occurred.
Definition at line 159 of file exception.h.
uint32_t jwscxx::base::Exception::line [protected] |
Line number where the Error occurred.
Definition at line 162 of file exception.h.