|
16 | 16 |
|
17 | 17 | #pragma once |
18 | 18 |
|
| 19 | +#include "CommonExport.h" |
19 | 20 | #include <exception> |
20 | | -#include <string> |
21 | 21 | #include <sstream> |
22 | | -#include "CommonExport.h" |
| 22 | +#include <string> |
23 | 23 |
|
24 | 24 | #pragma warning(push) |
25 | | -//#pragma warning(disable: 4275) // warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class |
| 25 | +// #pragma warning(disable: 4275) // warning C4275: non dll-interface class |
| 26 | +// 'std::exception' used as base for dll-interface class |
26 | 27 |
|
27 | 28 | namespace Tools |
28 | 29 | { |
29 | 30 |
|
30 | | - class VCOV_COMMONEXPORT_DLL ExceptionBase : public std::exception |
31 | | - { |
32 | | - protected: |
33 | | - ExceptionBase(const std::wstring& message); |
34 | | - }; |
| 31 | + class VCOV_COMMONEXPORT_DLL ExceptionBase : public std::exception |
| 32 | + { |
| 33 | + protected: |
| 34 | + ExceptionBase(const std::wstring& message); |
| 35 | + }; |
35 | 36 |
|
36 | | - VCOV_COMMONEXPORT_DLL std::wstring GetFilename(const char*); |
37 | | -} |
| 37 | + VCOV_COMMONEXPORT_DLL std::wstring GetFilename(const char*); |
| 38 | +} // namespace Tools |
38 | 39 |
|
39 | 40 | #pragma warning(pop) |
40 | 41 |
|
41 | | -#define GENERATE_EXCEPTION_CLASS(namespaceName, exceptionName) \ |
42 | | -namespace namespaceName \ |
43 | | -{ \ |
44 | | - class exceptionName : public Tools::ExceptionBase \ |
45 | | - { \ |
46 | | - public: \ |
47 | | - explicit exceptionName(const std::wstring& message) \ |
48 | | - : ExceptionBase(message) \ |
49 | | - { \ |
50 | | - } \ |
51 | | - }; \ |
52 | | -} |
53 | | - |
54 | | -#define THROW_BASE(namespaceName, className, message) \ |
55 | | - do \ |
56 | | - { \ |
57 | | - std::wostringstream ostr; \ |
58 | | - ostr << Tools::GetFilename(__FILE__) << ':' << __LINE__ << ' ' \ |
59 | | - << message; \ |
60 | | - throw namespaceName::className(ostr.str()); \ |
61 | | - } while (false) |
| 42 | +#define GENERATE_EXCEPTION_CLASS(namespaceName, exceptionName) \ |
| 43 | + namespace namespaceName \ |
| 44 | + { \ |
| 45 | + class exceptionName : public Tools::ExceptionBase \ |
| 46 | + { \ |
| 47 | + public: \ |
| 48 | + explicit exceptionName(const std::wstring& message) : ExceptionBase(message) \ |
| 49 | + { \ |
| 50 | + } \ |
| 51 | + }; \ |
| 52 | + } |
| 53 | + |
| 54 | +#define THROW_BASE(namespaceName, className, message) \ |
| 55 | + do \ |
| 56 | + { \ |
| 57 | + std::wostringstream ostr; \ |
| 58 | + ostr << Tools::GetFilename(__FILE__) << ':' << __LINE__ << ' ' << message; \ |
| 59 | + throw namespaceName::className(ostr.str()); \ |
| 60 | + } while (false) |
0 commit comments