blob: 223373683ff94fa9dde0beed835ee18e8c9fc28f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <string>
#include <exception>
#include <stdarg.h>
/**
* A generalized Exception base class. This is nice for making general and
* flexible child classes that can create new error code classes.
*/
class Exception : public std::exception
{
public:
/**
* Construct an exception with an error code of zero, but with a
* description. The use of this is not reccomended most of the time, it's
* generally best to include an error code with the exception so your
* program can handle the exception in a better way.
* @param sFormat The format of the text. See printf for more info.
*/
Exception( const char *sFormat, ... ) throw();
/**
*
* @param nCode
* @param sFormat
*/
Exception( int nCode, const char *sFormat, ... ) throw();
/**
*
* @param nCode
* @return
*/
Exception( int nCode=0 ) throw();
/**
*
* @return
*/
virtual ~Exception() throw();
/**
*
* @return
*/
virtual const char *what() const throw();
/**
*
* @return
*/
int getErrorCode();
/**
*
* @param lpFormat
* @param vargs
*/
void setWhat( const char *lpFormat, va_list &vargs );
private:
char *sWhat; /**< The text string telling people what went wrong. */
int nErrorCode; /**< The code for the error that occured. */
};
#endif
|