Oncaphillis::Ligh++pd

niftyLib::iexception_t< SUPER > Class Template Reference

#include <src/niftylib/iexception.h>


Detailed Description

template<typename SUPER>
class niftyLib::iexception_t< SUPER >

Class template for a generic exception object which extends the SUPER class and provides the pure virtual std::exception::what method.

The only template argument defines the super class from which we are supposed to inherit. We also provide a static std::ostream offspring which generates the appropriate exception when writing std::ends to it.

Throwing the appropriate exception becomes as easy as this.

      niftyLib::Exception::out << "Uhhh something went zilch";

      throw niftyLib::Exception();

See also:
iexception_stream_t

Public Types

typedef iexception_stream_t< meostream
 A typedef for the type of ostream the exception is associated with.

Public Member Functions

 iexception_t (const std::string &w) throw ()
 Create from std::string.
 iexception_t (const me &e) throw ()
 Copy constructor.
 iexception_t (const std::exception &e) throw ()
 Initialize from std::exception.
 iexception_t (ostream &o=out) throw ()
 ~iexception_t () throw ()
 Destructor.
const char * what () const throw ()
 Return the message as a const char pointer, as demandet by the pure virtual method from std::exception.
virtual std::string toString () const
 A more sophisticates way to return what the exception is all about.

Static Public Attributes

static ostreamout = lighttpd::IO::errorStream
 This is the most fancy part of iexception_t this std::ostream can be used to simplify the generation of what messages.

Protected Member Functions

void what (const std::string &m)

Member Typedef Documentation

template<typename SUPER>
typedef iexception_stream_t<me> niftyLib::iexception_t< SUPER >::ostream

A typedef for the type of ostream the exception is associated with.

Writing to an ostream of that type will throw an iexception_t when flushing (i.e. doing an << std::flush or << std::endl on that stream.

See also:
iexception_stream_t


Constructor & Destructor Documentation

template<typename SUPER>
niftyLib::iexception_t< SUPER >::iexception_t ( const std::string &  w  )  throw () [inline]

Create from std::string.

Explicitly set the what message.

References niftyLib::iexception_t< SUPER >::what().

template<typename SUPER>
niftyLib::iexception_t< SUPER >::iexception_t ( const me e  )  throw () [inline]

Copy constructor.

We seem tp need this sonce the standard operation does not like our std::stringstream to be copied.

References niftyLib::iexception_t< SUPER >::what().

template<typename SUPER>
niftyLib::iexception_t< SUPER >::iexception_t ( const std::exception &  e  )  throw () [inline]

Initialize from std::exception.

Inherit the what string.

References niftyLib::iexception_t< SUPER >::what().

template<typename SUPER>
niftyLib::iexception_t< SUPER >::iexception_t ( ostream o = out  )  throw () [inline]

template<typename SUPER>
niftyLib::iexception_t< SUPER >::~iexception_t (  )  throw () [inline]

Destructor.


Member Function Documentation

template<typename SUPER>
const char* niftyLib::iexception_t< SUPER >::what (  )  const throw () [inline]

Return the message as a const char pointer, as demandet by the pure virtual method from std::exception.

Referenced by niftyLib::iexception_t< SUPER >::iexception_t(), and niftyLib::iexception_t< SUPER >::toString().

template<typename SUPER>
virtual std::string niftyLib::iexception_t< SUPER >::toString (  )  const [inline, virtual]

A more sophisticates way to return what the exception is all about.

Returns a std::string instead of a char * and is made virtual so subclasses might add nifty stuff. The base method just returns what as a std::string object.

See also:
what

References niftyLib::iexception_t< SUPER >::what().

template<typename SUPER>
void niftyLib::iexception_t< SUPER >::what ( const std::string &  m  )  [inline, protected]


Field Documentation

template<typename SUPER>
Exception::ostream & niftyLib::Exception::out = lighttpd::IO::errorStream [inline, static]


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

Generated by  doxygen
© 2008; Dr. Sebastian Kloska ( Oncaphillis )
Powered by: [?]