Changeset 138 for XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp
- Timestamp:
- 12/10/10 16:04:54 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp
r137 r138 10 10 namespace XMLIOSERVER 11 11 { 12 class XMLIOException : public Exception 12 13 class XMLIOError : public std::ostringstream 13 14 { 15 private : 16 17 class XMLIOException : public Exception 18 { 19 public : 20 21 XMLIOException(int _code) 22 : Exception(_code) 23 { /* Ne rien faire de plus */ } 24 25 XMLIOException(const std::string& _msg, int _code = 0) 26 : Exception(_msg, _code) 27 { /* Ne rien faire de plus */ } 28 29 XMLIOException(const std::string& _msg, const std::string& _arg, int _code) 30 : Exception(_msg, _arg, _code) 31 { /* Ne rien faire de plus */ } 32 33 XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code) 34 : Exception(_msg, _exc, _code) 35 { /* Ne rien faire de plus */ } 36 37 XMLIOException(const XMLIOException& _exc) 38 : Exception(_exc) 39 { /* Ne rien faire de plus */ } 40 41 ~XMLIOException(void) throw() 42 { std::cerr << displayText() << std::endl; } 43 44 XMLIOException& operator = (const XMLIOException& _exc) 45 { Exception::operator = (_exc); return *this; } 46 47 public : /* virtual */ 48 49 virtual const char* name(void) const throw() { return ("XMLIO>XMLIOException"); } 50 virtual const char* className(void) const throw() { return (typeid(*this).name()); } 51 52 virtual Exception* clone(void) const { return new XMLIOException(*this); } 53 virtual void rethrow(void) const { throw *this; } 54 55 }; // class XMLIOException 56 14 57 public : 15 58 16 XMLIOE xception(int _code)17 : Exception(_code)59 XMLIOError(const std::string _msg) 60 : msg(_msg) 18 61 { /* Ne rien faire de plus */ } 19 62 20 XMLIOException(const std::string& _msg, int _code) 21 : Exception(_msg, _code) 22 { /* Ne rien faire de plus */ } 63 ~XMLIOError(void) 64 { throw XMLIOException(msg); } 23 65 24 XMLIOException(const std::string& _msg, const std::string& _arg, int _code) 25 : Exception(_msg, _arg, _code) 26 { /* Ne rien faire de plus */ } 66 private : 27 67 28 XMLIOException(const std::string& _msg, const Poco::Exception& _exc, int _code) 29 : Exception(_msg, _exc, _code) 30 { /* Ne rien faire de plus */ } 31 32 XMLIOException(const XMLIOException& _exc) 33 : Exception(_exc) 34 { /* Ne rien faire de plus */ } 35 36 ~XMLIOException(void) throw() 37 { std::cerr << displayText() << std::endl; } 38 39 XMLIOException& operator = (const XMLIOException& _exc) 40 { Exception::operator = (_exc); return *this; } 41 42 virtual const char* name(void) const throw() { return ("XMLIO>XMLIOException"); } 43 virtual const char* className(void) const throw() { return (typeid(*this).name()); } 44 45 virtual Exception* clone(void) const { return new XMLIOException(*this); } 46 virtual void rethrow(void) const { throw *this; } 68 std::string msg; 47 69 48 70 }; // class XMLIOException 49 50 class XMLIOUndefinedValueException : public XMLIOException51 {52 public :53 XMLIOUndefinedValueException(const std::string& _msg)54 : XMLIOException(_msg, 1001)55 { /* Ne rien faire de plus */ }56 57 const char* name(void) const throw()58 { return ("XMLIO>UndefinedValueException"); }59 60 ~XMLIOUndefinedValueException(void) throw()61 { std::cerr << displayText() << std::endl; }62 63 }; //class XMLIOUndefinedException64 65 class XMLIOStreamException : public XMLIOException66 {67 public :68 XMLIOStreamException(const std::string& _msg)69 : XMLIOException(_msg, 1002)70 { /* Ne rien faire de plus */ }71 72 const char* name(void) const throw()73 { return ("XMLIO>StreamException"); }74 75 }; //class XMLIOStreamException76 77 class XMLParsingException : public XMLIOException78 {79 public :80 XMLParsingException(const std::string& _msg)81 : XMLIOException(_msg, 1003)82 { /* Ne rien faire de plus */ }83 84 const char* name(void) const throw()85 { return ("XMLIO>XMLParsingException"); }86 87 }; //class XMLParsingException88 89 class XMLIOIncompatibleTypeException : public XMLIOException90 {91 public :92 XMLIOIncompatibleTypeException(const std::string& _msg)93 : XMLIOException(_msg, 1003)94 { /* Ne rien faire de plus */ }95 96 const char* name(void) const throw()97 { return ("XMLIO>XMLIOIncompatibeTypeException"); }98 99 }; //class XMLIOIncompatibleTypeException100 101 // A compléter.102 71 103 72 }// namespace XMLIOSERVER
Note: See TracChangeset
for help on using the changeset viewer.