diff options
Diffstat (limited to 'src/exception.h')
-rw-r--r-- | src/exception.h | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/exception.h b/src/exception.h index be876d7..2233736 100644 --- a/src/exception.h +++ b/src/exception.h | |||
@@ -3,20 +3,66 @@ | |||
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <exception> | 5 | #include <exception> |
6 | #include <stdarg.h> | ||
6 | 7 | ||
8 | /** | ||
9 | * A generalized Exception base class. This is nice for making general and | ||
10 | * flexible child classes that can create new error code classes. | ||
11 | */ | ||
7 | class Exception : public std::exception | 12 | class Exception : public std::exception |
8 | { | 13 | { |
9 | public: | 14 | 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 | */ | ||
10 | Exception( const char *sFormat, ... ) throw(); | 22 | Exception( const char *sFormat, ... ) throw(); |
23 | |||
24 | /** | ||
25 | * | ||
26 | * @param nCode | ||
27 | * @param sFormat | ||
28 | */ | ||
11 | Exception( int nCode, const char *sFormat, ... ) throw(); | 29 | Exception( int nCode, const char *sFormat, ... ) throw(); |
30 | |||
31 | /** | ||
32 | * | ||
33 | * @param nCode | ||
34 | * @return | ||
35 | */ | ||
36 | Exception( int nCode=0 ) throw(); | ||
37 | |||
38 | /** | ||
39 | * | ||
40 | * @return | ||
41 | */ | ||
12 | virtual ~Exception() throw(); | 42 | virtual ~Exception() throw(); |
13 | 43 | ||
44 | /** | ||
45 | * | ||
46 | * @return | ||
47 | */ | ||
14 | virtual const char *what() const throw(); | 48 | virtual const char *what() const throw(); |
49 | |||
50 | /** | ||
51 | * | ||
52 | * @return | ||
53 | */ | ||
15 | int getErrorCode(); | 54 | int getErrorCode(); |
55 | |||
56 | /** | ||
57 | * | ||
58 | * @param lpFormat | ||
59 | * @param vargs | ||
60 | */ | ||
61 | void setWhat( const char *lpFormat, va_list &vargs ); | ||
16 | 62 | ||
17 | private: | 63 | private: |
18 | char *sWhat; | 64 | char *sWhat; /**< The text string telling people what went wrong. */ |
19 | int nErrorCode; | 65 | int nErrorCode; /**< The code for the error that occured. */ |
20 | }; | 66 | }; |
21 | 67 | ||
22 | #endif | 68 | #endif |