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

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

#1 work for CRXProxy and CRXException

File size: 1.0 KB
Line 
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
19class CRXException
20{
21private:
22 std::string mMessage;
23 int mCode;
24
25public:
26 CRXException (void);
27
28public:
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.