ThrowStream
 All Classes Files Functions Variables Friends Macros
Public Member Functions | Private Attributes | Friends | List of all members
ThrowStream Class Reference

Main ThrowStream class. More...

#include <ThrowStream.h>

Inheritance diagram for ThrowStream:
Inheritance graph
[legend]
Collaboration diagram for ThrowStream:
Collaboration graph
[legend]

Public Member Functions

 ThrowStream (const unsigned long line, const string &file, const string &function)
 Construct using the line, file, and function. More...
 
 ThrowStream (const exception &ex, unsigned long line, const string &file, const string &function)
 Construct by copying an exception and adding a new line, file, and function. More...
 
 ~ThrowStream () throw ()
 Destructor definition needed to declare it throw() More...
 
ThrowStreamAppend (const unsigned long line, const string &file, const string &function)
 Add a new line to the backtrace. More...
 
ThrowStreamAppend (const exception &ex, const unsigned long line, const string &file, const string &function)
 Add a new line to the backtrace, copying an existing exception. More...
 
char const * what () const throw ()
 Get the description as a character array. More...
 
template<typename T >
ThrowStreamoperator<< (const T &rhs)
 Add information to the current entry in the backtrace. More...
 

Private Attributes

string _desc
 The current, full backtrace. More...
 

Friends

ostream & operator<< (ostream &os, const ThrowStream &ts)
 Allow output to an ostream using the stream operator. More...
 

Detailed Description

Main ThrowStream class.

This class allows appending of exception information, creating a backtrace-like output.

Definition at line 32 of file ThrowStream.h.

Constructor & Destructor Documentation

ThrowStream::ThrowStream ( const unsigned long  line,
const string &  file,
const string &  function 
)
inline

Construct using the line, file, and function.

Parameters
[in]lineThe line on which the exception occurred
[in]fileThe file in which the exception occurred
[in]functionfunction The function in which the exception occurred

Definition at line 47 of file ThrowStream.h.

Here is the call graph for this function:

ThrowStream::ThrowStream ( const exception &  ex,
unsigned long  line,
const string &  file,
const string &  function 
)
inline

Construct by copying an exception and adding a new line, file, and function.

Parameters
[in]exAn exception to copy
[in]lineThe line on which the exception occurred
[in]fileThe file in which the exception occurred
[in]functionfunction The function in which the exception occurred

Definition at line 60 of file ThrowStream.h.

Here is the call graph for this function:

ThrowStream::~ThrowStream ( )
throw (
)
inline

Destructor definition needed to declare it throw()

Definition at line 66 of file ThrowStream.h.

Member Function Documentation

ThrowStream& ThrowStream::Append ( const unsigned long  line,
const string &  file,
const string &  function 
)
inline

Add a new line to the backtrace.

This returns ThrowStream & to allow using operator<<

Parameters
[in]lineThe line on which the exception occurred
[in]fileThe file in which the exception occurred
[in]functionfunction The function in which the exception occurred

Definition at line 77 of file ThrowStream.h.

Here is the caller graph for this function:

ThrowStream& ThrowStream::Append ( const exception &  ex,
const unsigned long  line,
const string &  file,
const string &  function 
)
inline

Add a new line to the backtrace, copying an existing exception.

This returns ThrowStream & to allow using operator<<

Parameters
[in]exAn exception to copy
[in]lineThe line on which the exception occurred
[in]fileThe file in which the exception occurred
[in]functionfunction The function in which the exception occurred

Definition at line 102 of file ThrowStream.h.

Here is the call graph for this function:

template<typename T >
ThrowStream& ThrowStream::operator<< ( const T &  rhs)
inline

Add information to the current entry in the backtrace.

Parameters
[in]rhsData to add. This must be able to be inserted into a stringstream object.
Returns
The modified ThrowStream object

Definition at line 143 of file ThrowStream.h.

char const* ThrowStream::what ( ) const
throw (
)
inline

Get the description as a character array.

This will output a (hopefully) nice backtrace

Returns
An array of characters representing the backtrace

Definition at line 130 of file ThrowStream.h.

Here is the caller graph for this function:

Friends And Related Function Documentation

ostream& operator<< ( ostream &  os,
const ThrowStream ts 
)
friend

Allow output to an ostream using the stream operator.

Parameters
[in,out]osAn ostream object to output to
[in]tsA throwstream object to output
Returns
The ostream object again

Member Data Documentation

string ThrowStream::_desc
private

The current, full backtrace.

Definition at line 35 of file ThrowStream.h.


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