Rev | Line | |
---|
[18] | 1 | /**
|
---|
| 2 | * CRXException.h
|
---|
| 3 | */
|
---|
| 4 | #ifndef __CRXEXCEPTION_H__
|
---|
| 5 | #define __CRXEXCEPTION_H__
|
---|
| 6 |
|
---|
| 7 | #include <string>
|
---|
[19] | 8 | #include <stdarg.h>
|
---|
[18] | 9 |
|
---|
| 10 | #ifdef _WIN32
|
---|
| 11 | # define __func__ __FUNCTION__
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
[19] | 14 | #define CRX_ERROR(__CODE,__FMT,...) \
|
---|
| 15 | do { \
|
---|
| 16 | SetErrorCode (__CODE); \
|
---|
| 17 | SetErrorMessage (__FILE__,__func__,__LINE__,__FMT,##__VA_ARGS__); \
|
---|
[18] | 18 | } while (0)
|
---|
| 19 |
|
---|
[19] | 20 | #define CRX_ERROR_ADD(__MESSAGE) \
|
---|
| 21 | do { \
|
---|
| 22 | AddMessage (__MESSAGE); \
|
---|
| 23 | } while (0)
|
---|
| 24 |
|
---|
[18] | 25 | class CRXException
|
---|
| 26 | {
|
---|
| 27 | private:
|
---|
| 28 | std::string mMessage;
|
---|
| 29 | int mCode;
|
---|
| 30 |
|
---|
| 31 | public:
|
---|
| 32 | CRXException (void);
|
---|
| 33 |
|
---|
| 34 | public:
|
---|
| 35 | /* get */
|
---|
| 36 | int GetErrorCode (void) const;
|
---|
| 37 |
|
---|
| 38 | std::string GetErrorMessage (void) const;
|
---|
| 39 |
|
---|
| 40 | int GetSystemErrorCode (void) const;
|
---|
| 41 |
|
---|
| 42 | /* set */
|
---|
| 43 | void SetErrorCode (const int aCode);
|
---|
| 44 |
|
---|
| 45 | void SetErrorMessage (const char * aFile,
|
---|
| 46 | const char * aFunction,
|
---|
| 47 | const int aLine,
|
---|
| 48 | const char * aFormat, ...);
|
---|
| 49 |
|
---|
| 50 | std::string MakeErrorMessage (const char * aFile,
|
---|
| 51 | const char * aFunction,
|
---|
| 52 | const int aLine,
|
---|
| 53 | const char * aFormat,
|
---|
| 54 | va_list aVaList);
|
---|
[19] | 55 |
|
---|
| 56 | void AddMessage (const char * aMessage);
|
---|
[18] | 57 | };
|
---|
| 58 |
|
---|
[19] | 59 | #endif // #ifndef __CRXEXCEPTION_H__
|
---|
Note:
See
TracBrowser
for help on using the repository browser.