OpenWalnut  1.4.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends
WException Class Reference

Basic exception handler. More...

#include <WException.h>

+ Inheritance diagram for WException:

List of all members.

Public Member Functions

 WException (const std::string &msg=std::string())
 Default constructor.
 WException (const std::exception &e)
 Copy a std::exception and encapsulate it.
virtual ~WException () throw ()
 Destructor.
virtual const char * what () const throw ()
 Returns the message string set on throw.
std::string getTrace () const
 Prints the trace of the call chain which caused this exception.
std::string getBacktrace () const
 Returns a call stacktrace.

Static Public Member Functions

static void disableBacktrace ()
 Function disables backtraces.

Protected Attributes

std::string m_msg
 Message given during throw.
std::list< std::string > m_trace
 Stack trace for identifying the source where this exception came from.

Static Protected Attributes

static bool noBacktrace = false
 True if the backtrace should NOT be printed.

Private Attributes

WTerminalColor m_labelColor
 Color used for the "trace:" label.
WTerminalColor m_functionColor
 Color used for function name.
WTerminalColor m_symbolColor
 Color used for symbols.
WTerminalColor m_headlineColor
 Color used for exception headline.

Friends

class WExceptionTest
 Only UnitTests are allowed to be a friend of this class.

Detailed Description

Basic exception handler.

Definition at line 38 of file WException.h.


Constructor & Destructor Documentation

WException::WException ( const std::string &  msg = std::string()) [explicit]

Default constructor.

Parameters:
msgException description.

Definition at line 50 of file WException.cpp.

References getBacktrace(), m_headlineColor, m_msg, and noBacktrace.

WException::WException ( const std::exception &  e) [explicit]

Copy a std::exception and encapsulate it.

Parameters:
ethe exception.

Definition at line 68 of file WException.cpp.

References getBacktrace(), m_headlineColor, m_msg, and noBacktrace.

WException::~WException ( ) throw () [virtual]

Destructor.

Definition at line 85 of file WException.cpp.


Member Function Documentation

void WException::disableBacktrace ( ) [static]
std::string WException::getBacktrace ( ) const

Returns a call stacktrace.

Returns:
The backtrace at the moment of "throw".

Definition at line 107 of file WException.cpp.

References m_functionColor, m_labelColor, m_symbolColor, and what().

Referenced by WExceptionTest::testBacktrace(), and WException().

std::string WException::getTrace ( ) const

Prints the trace of the call chain which caused this exception.

Returns:
Calltrace as string
Notes:
Isn't this useless? Should be removed.

Definition at line 96 of file WException.cpp.

References m_trace, and what().

Referenced by WExceptionTest::testGetMessage().

const char * WException::what ( ) const throw () [virtual]

Friends And Related Function Documentation

friend class WExceptionTest [friend]

Only UnitTests are allowed to be a friend of this class.

Definition at line 43 of file WException.h.


Member Data Documentation

Color used for function name.

Definition at line 114 of file WException.h.

Referenced by getBacktrace().

Color used for exception headline.

Definition at line 124 of file WException.h.

Referenced by WException().

Color used for the "trace:" label.

Definition at line 109 of file WException.h.

Referenced by getBacktrace().

std::string WException::m_msg [protected]

Message given during throw.

Definition at line 93 of file WException.h.

Referenced by WException(), what(), and WSegmentationFault::WSegmentationFault().

Color used for symbols.

Definition at line 119 of file WException.h.

Referenced by getBacktrace().

std::list< std::string > WException::m_trace [protected]

Stack trace for identifying the source where this exception came from.

Notes:
Isn't this useless? Should be removed.

Definition at line 99 of file WException.h.

Referenced by getTrace(), and WExceptionTest::testGetMessage().

bool WException::noBacktrace = false [static, protected]

True if the backtrace should NOT be printed.

initialize static member.

Definition at line 104 of file WException.h.

Referenced by disableBacktrace(), and WException().


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