diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-05-26 04:03:24 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-05-26 04:03:24 +0000 |
commit | bd5bb1ca60a6a97b110cbf221b3625e6e6200141 (patch) | |
tree | 063b1576b57aba698159f50a04461ddfb7c4dfb6 /src/exception.h | |
parent | bc6f456ef27bdf25bf7a7f677217b9b7204b4241 (diff) | |
download | libbu++-bd5bb1ca60a6a97b110cbf221b3625e6e6200141.tar.gz libbu++-bd5bb1ca60a6a97b110cbf221b3625e6e6200141.tar.bz2 libbu++-bd5bb1ca60a6a97b110cbf221b3625e6e6200141.tar.xz libbu++-bd5bb1ca60a6a97b110cbf221b3625e6e6200141.zip |
Loads of updates to several systems, see each for what really changed, the
biggest are the updates to the exception framework, and to the pproc system,
which is almost a competitor to popt already...
Diffstat (limited to '')
-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 |