source: XMLIO_V2/dev/dev_rv/src/XMLIO/exception.hpp @ 137

Last change on this file since 137 was 137, checked in by hozdoba, 14 years ago

mise à jour

File size: 3.1 KB
Line 
1#ifndef __XMLIO_EXCEPTION__
2#define __XMLIO_EXCEPTION__
3
4// Classes utilisées issues de la STL
5using std::string;
6
7// Classes utilisées issues de Poco
8using Poco::Exception;
9
10namespace XMLIOSERVER
11{
12   class XMLIOException : public Exception
13   {
14      public :
15
16         XMLIOException(int _code)
17            : Exception(_code)
18         { /* Ne rien faire de plus */ }
19
20         XMLIOException(const std::string& _msg, int _code)
21            : Exception(_msg, _code)
22         { /* Ne rien faire de plus */ }
23
24         XMLIOException(const std::string& _msg, const std::string& _arg, int _code)
25            : Exception(_msg, _arg, _code)
26         { /* Ne rien faire de plus */ }
27
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; }
47
48   }; // class XMLIOException
49
50   class XMLIOUndefinedValueException : public XMLIOException
51   {
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 XMLIOUndefinedException
64
65   class XMLIOStreamException : public XMLIOException
66   {
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 XMLIOStreamException
76
77   class XMLParsingException : public XMLIOException
78   {
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 XMLParsingException
88
89   class XMLIOIncompatibleTypeException : public XMLIOException
90   {
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 XMLIOIncompatibleTypeException
100
101   // A compléter.
102
103}// namespace XMLIOSERVER
104
105#endif // __XMLIO_EXCEPTION__
Note: See TracBrowser for help on using the repository browser.