source: XMLIO_V2/dev/common/src/xmlio/exception.cpp @ 219

Last change on this file since 219 was 219, checked in by hozdoba, 13 years ago

Préparation nouvelle arborescence

File size: 1.3 KB
Line 
1#include "exception.hpp"
2
3/// boost headers ///
4#include <boost/cast.hpp>
5
6namespace xmlioserver
7{
8  /// ////////////////////// Définitions ////////////////////// ///
9   CException::CException(void)
10      : CObject(), desc_rethrow(true)
11   { /* Ne rien faire de plus */ }
12
13   CException::CException(const StdString & id)
14      : CObject(id), desc_rethrow(true)
15   { /* Ne rien faire de plus */ }
16
17   CException::CException(const CException & exception)
18      : std::basic_ios<char>()
19      , CObject(exception.getId())
20      , StdOStringStream()
21      , desc_rethrow(false)
22   { (*this) << exception.str(); }
23
24   CException::~CException(void)
25   { if (desc_rethrow) throw (*this); }
26
27   //---------------------------------------------------------------
28
29   StdString CException::getMessage(void) const
30   {
31      StdOStringStream oss;
32      oss << "> Error [" << this->getId() << "] : " << this->str();
33      return (oss.str());
34   }
35
36   StdOStringStream &  CException::getStream(void)
37   { return (*boost::polymorphic_cast<StdOStringStream*>(this)); }
38
39   StdString CException::toString(void) const
40   { return (StdString(this->getMessage())); }
41
42   void CException::fromString(const StdString & str)
43   { this->str(str); }
44
45   //---------------------------------------------------------------
46
47} // namespace xmlioserver
Note: See TracBrowser for help on using the repository browser.