NANA
error.h
浏览该文件的文档.
1#pragma once
15#include "core_global.h"
16#include <vcruntime_exception.h>
17#include <string>
18namespace NANA {
19
23
26class NA_API Exception NA_FINAL: public std::exception
27{
28public:
37 Exception(int _code, const String& _err, const String& _func, const String& _file, int _line);
38 virtual ~Exception() throw();
39
43 virtual const char* what() const throw();
44 void formatMessage();
45
46 String msg;
47
48 int code;
49 String err;
50 String func;
51 String file;
52 int line;
53};
54
56#define NA_Assert( expr ) do { if(!!(expr)) ; else throw NANA::Exception( NANA::Error::ERR_ASSERT, #expr, __FUNCTION__, __FILE__, __LINE__ ); } while(0);
57
58
59
63class CError {
64public:
65 static CError* instance(std::string filename = "error.txt");
66private:
67 CError(std::string& filename);
68
69 std::string m_filename;//记录错误的文件
70
71
72};
73
74
76
77
78
79}
80
用于异常抛出
Definition: error.h:27
Exception(int _code, const String &_err, const String &_func, const String &_file, int _line)
全局头文件
#define NA_API
兼容windows系统与linux系统
Definition: core_global.h:24