source: cheroxy/trunk/include/CRXException.h@ 19

Last change on this file since 19 was 19, checked in by cheese, 11 years ago

#1 fix error on linux for r18

File size: 1.2 KB
Line 
1/**
2 * CRXException.h
3 */
4#ifndef __CRXEXCEPTION_H__
5#define __CRXEXCEPTION_H__
6
7#include <string>
8#include <stdarg.h>
9
10#ifdef _WIN32
11# define __func__ __FUNCTION__
12#endif
13
14#define CRX_ERROR(__CODE,__FMT,...) \
15 do { \
16 SetErrorCode (__CODE); \
17 SetErrorMessage (__FILE__,__func__,__LINE__,__FMT,##__VA_ARGS__); \
18 } while (0)
19
20#define CRX_ERROR_ADD(__MESSAGE) \
21 do { \
22 AddMessage (__MESSAGE); \
23 } while (0)
24
25class CRXException
26{
27private:
28 std::string mMessage;
29 int mCode;
30
31public:
32 CRXException (void);
33
34public:
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);
55
56 void AddMessage (const char * aMessage);
57};
58
59#endif // #ifndef __CRXEXCEPTION_H__
Note: See TracBrowser for help on using the repository browser.