ders::Exception Class Reference

Base exception class with embed location, message and nested exception. More...

#include <exception.hpp>

Inheritance diagram for ders::Exception:

ders::destroyable ders::ErrorException ders::ExternException ders::MsgException ders::FileErrorException ders::StdExternException ders::UnknExternException ders::ExitMsgException

List of all members.

Public Member Functions

virtual sh_text getClassName () const
virtual sh_text toText () const
template<class E>
E * is ()
template<class E>
const E * is () const
virtual void destroy (mem_pool &mp2)

Public Attributes

const FileLine location
const sh_text message
const shException nested

Protected Member Functions

 Exception (const FileLine &loc, const ch_rng &msg, shException nest)
void operator delete (void *ptr, size_t size)

Static Protected Member Functions

template<class T>
static void destroy_this (T *ptr, mem_pool &mp2)

Friends

shException newException (const FileLine &loc, const ch_rng &msg, shException nest)


Detailed Description

Base exception class with embed location, message and nested exception.

Definition at line 66 of file exception.hpp.


Constructor & Destructor Documentation

ders::Exception::Exception ( const FileLine loc,
const ch_rng msg,
shException  nest 
) [protected]

Definition at line 58 of file exception.cpp.

00059   : location(loc), message(nt(nest.pool(), msg)), nested(nest)
00060 {
00061 }


Member Function Documentation

sh_text ders::Exception::getClassName (  )  const [virtual]

Reimplemented in ders::ErrorException, ders::MsgException, ders::ExitMsgException, ders::ExternException, ders::StdExternException, ders::UnknExternException, and ders::FileErrorException.

Definition at line 63 of file exception.cpp.

00064 {
00065  return nt(message.pool(), "ders::Exception");
00066 }

sh_text ders::Exception::toText (  )  const [virtual]

Reimplemented in ders::ErrorException, ders::ExitMsgException, ders::ExternException, and ders::FileErrorException.

Definition at line 68 of file exception.cpp.

00069 {
00070  return text_buf(getClassName())+" ["+location.file+":"+location.line+
00071    "], message: "+message;
00072 }

template<class E>
E * ders::Exception::is (  )  [inline]

Definition at line 205 of file exception.hpp.

00206 { return dynamic_cast<E*>(this); }

template<class E>
const E * ders::Exception::is (  )  const [inline]

Definition at line 208 of file exception.hpp.

00209 { return dynamic_cast<const E*>(this); }

virtual void ders::Exception::destroy ( mem_pool mp2  )  [inline, virtual]

template<class T>
void ders::destroyable::destroy_this ( T *  ptr,
mem_pool mp2 
) [inline, static, protected, inherited]

Definition at line 47 of file destroy.hpp.

00048 {
00049  assert(typeid(*ptr)==typeid(T));
00050 
00051  ptr->~T();
00052  mp2.deallocate(ptr, sizeof(T));
00053 }

void ders::destroyable::operator delete ( void *  ptr,
size_t  size 
) [inline, protected, inherited]

Definition at line 39 of file destroy.hpp.

00039 { hard_assert(false); }


Friends And Related Function Documentation

shException newException ( const FileLine loc,
const ch_rng msg,
shException  nest 
) [friend]


Member Data Documentation

Definition at line 77 of file exception.hpp.

Definition at line 78 of file exception.hpp.

Definition at line 79 of file exception.hpp.


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

Generated on Tue Dec 8 11:35:33 2009 for derslib by  doxygen 1.5.5