JWS C++ Library
C++ language utility library
jwscxx::base::Exception Class Reference

Base class of all exceptions in the jwsc++ library. More...

#include <exception.h>

Inheritance diagram for jwscxx::base::Exception:
Collaboration diagram for jwscxx::base::Exception:

List of all members.

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.

Detailed Description

Base class of all exceptions in the jwsc++ library.

Definition at line 74 of file exception.h.


Constructor & Destructor Documentation

Exception::Exception ( const char *  msg,
const char *  file = 0,
uint32_t  line = 0 
)

Constructs an Exception.

Parameters:
msgError message.
fileFile where the error occurred.
lineLine 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.

Parameters:
msgError message.
fileFile where the error occurred.
lineLine approximately where the error occurred.

Definition at line 90 of file exception.cpp.

Exception::Exception ( const Exception e)

Constructs an Exception from another.

Parameters:
eException 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.


Member Function Documentation

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.

Parameters:
outOutput stream to print to.
newlineWhether 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.

Parameters:
outOutput stream to print to.
newlineWhether 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.

Parameters:
outOutput stream to print to.
newlineWhether 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.

Parameters:
outOutput stream to print to.
newlineWhether 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.

Parameters:
outOutput stream to print to.
newlineWhether to print a newline character.
statusExit 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.

Parameters:
outOutput stream to print to.
newlineWhether to print a newline character.
statusExit status.

Definition at line 181 of file exception.cpp.


Member Data Documentation

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.


The documentation for this class was generated from the following files: