diff options
-rw-r--r-- | src/exception.h | 31 | ||||
-rw-r--r-- | src/exceptionbase.cpp (renamed from src/exception.cpp) | 0 | ||||
-rw-r--r-- | src/xmlexception.cpp | 4 | ||||
-rw-r--r-- | src/xmlexception.h | 21 |
4 files changed, 39 insertions, 17 deletions
diff --git a/src/exception.h b/src/exception.h index 2233736..1234bef 100644 --- a/src/exception.h +++ b/src/exception.h | |||
@@ -65,4 +65,35 @@ private: | |||
65 | int nErrorCode; /**< The code for the error that occured. */ | 65 | int nErrorCode; /**< The code for the error that occured. */ |
66 | }; | 66 | }; |
67 | 67 | ||
68 | #define subExceptionDecl( name ) \ | ||
69 | class name : public Exception \ | ||
70 | { \ | ||
71 | public: \ | ||
72 | name( const char *sFormat, ... ) throw (); \ | ||
73 | name( int nCode, const char *sFormat, ... ) throw(); \ | ||
74 | name( int nCode=0 ) throw (); \ | ||
75 | }; | ||
76 | |||
77 | #define subExceptionDef( name ) \ | ||
78 | name::name( const char *lpFormat, ... ) throw() : \ | ||
79 | Exception( 0 ) \ | ||
80 | { \ | ||
81 | va_list ap; \ | ||
82 | va_start( ap, lpFormat ); \ | ||
83 | setWhat( lpFormat, ap ); \ | ||
84 | va_end( ap ); \ | ||
85 | } \ | ||
86 | name::name( int nCode, const char *lpFormat, ... ) throw() : \ | ||
87 | Exception( nCode ) \ | ||
88 | { \ | ||
89 | va_list ap; \ | ||
90 | va_start( ap, lpFormat ); \ | ||
91 | setWhat( lpFormat, ap ); \ | ||
92 | va_end( ap ); \ | ||
93 | } \ | ||
94 | name::name( int nCode ) throw() : \ | ||
95 | Exception( nCode ) \ | ||
96 | { \ | ||
97 | } | ||
98 | |||
68 | #endif | 99 | #endif |
diff --git a/src/exception.cpp b/src/exceptionbase.cpp index 3cde134..3cde134 100644 --- a/src/exception.cpp +++ b/src/exceptionbase.cpp | |||
diff --git a/src/xmlexception.cpp b/src/xmlexception.cpp index 7012ee6..9f38844 100644 --- a/src/xmlexception.cpp +++ b/src/xmlexception.cpp | |||
@@ -1,6 +1,9 @@ | |||
1 | #include "xmlexception.h" | 1 | #include "xmlexception.h" |
2 | #include <stdarg.h> | 2 | #include <stdarg.h> |
3 | 3 | ||
4 | subExceptionDef( XmlException ) | ||
5 | |||
6 | /* | ||
4 | XmlException::XmlException( const char *lpFormat, ... ) throw() : | 7 | XmlException::XmlException( const char *lpFormat, ... ) throw() : |
5 | Exception( 0 ) | 8 | Exception( 0 ) |
6 | { | 9 | { |
@@ -25,3 +28,4 @@ XmlException::XmlException( int nCode ) throw() : | |||
25 | Exception( nCode ) | 28 | Exception( nCode ) |
26 | { | 29 | { |
27 | } | 30 | } |
31 | */ | ||
diff --git a/src/xmlexception.h b/src/xmlexception.h index 9437ba3..5cbeda7 100644 --- a/src/xmlexception.h +++ b/src/xmlexception.h | |||
@@ -5,30 +5,17 @@ | |||
5 | #include "exception.h" | 5 | #include "exception.h" |
6 | #include <stdarg.h> | 6 | #include <stdarg.h> |
7 | 7 | ||
8 | /** | 8 | subExceptionDecl( XmlException ) |
9 | * A generalized Exception base class. This is nice for making general and | 9 | |
10 | * flexible child classes that can create new error code classes. | 10 | /* |
11 | */ | ||
12 | class XmlException : public Exception | 11 | class XmlException : public Exception |
13 | { | 12 | { |
14 | public: | 13 | public: |
15 | /** | ||
16 | * Construct an exception with an error code of zero, but with a | ||
17 | * description. The use of this is not reccomended most of the time, it's | ||
18 | * generally best to include an error code with the exception so your | ||
19 | * program can handle the exception in a better way. | ||
20 | * @param sFormat The format of the text. See printf for more info. | ||
21 | */ | ||
22 | XmlException( const char *sFormat, ... ) throw(); | 14 | XmlException( const char *sFormat, ... ) throw(); |
23 | 15 | ||
24 | /** | ||
25 | * | ||
26 | * @param nCode | ||
27 | * @param sFormat | ||
28 | */ | ||
29 | XmlException( int nCode, const char *sFormat, ... ) throw(); | 16 | XmlException( int nCode, const char *sFormat, ... ) throw(); |
30 | 17 | ||
31 | XmlException( int nCode=0 ) throw(); | 18 | XmlException( int nCode=0 ) throw(); |
32 | }; | 19 | };*/ |
33 | 20 | ||
34 | #endif | 21 | #endif |