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