-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception.h
More file actions
58 lines (42 loc) · 1.05 KB
/
exception.h
File metadata and controls
58 lines (42 loc) · 1.05 KB
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
#ifndef __EXCEPTION__HEAD__
#define __EXCEPTION__HEAD__
#ifdef _WIN32
#pragma warning (disable:4786)
#pragma warning (disable:4503)
#endif
#include "my_stl.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include "util.h"
//自定义异常类
class CException
{
public:
CException(int nCode, const string& strMsg);
CException(int nCode, const char* pszMsg);
//CException(int nCode, const char* pszMsg, ...);
~CException();
public:
inline int GetCode() const
{
return m_nCode;
}
inline string GetMsg() const
{
return m_strMsg;
}
private:
int m_nCode;
string m_strMsg;
};
inline void ThrowException(int n, const string& s)
{
throw CException(n, s);
}
//inline void throwException(int n, const char* s)
//{
// throw CException(n, s);
//}
extern void ThrowException(int n, const char* s, ...);
#endif