1:
2:
3: /*************
4: * *
5: * SENTINEL *
6: * *
7: *************/
8:
9:
10: #ifndef WWWI_MIND_EX_H
11: #define WWWI_MIND_EX_H
12:
13:
14: /**********************
15: * *
16: * COMPILER INCLUDES *
17: * *
18: **********************/
19:
20:
21: #include <exception>
22: #include <sstream>
23:
24:
25: /*********************
26: * *
27: * PROJECT INCLUDES *
28: * *
29: *********************/
30:
31:
32: #include "mind.h"
33:
34:
35: using std::exception;
36: using std::string;
37: using std::stringstream;
38:
39:
40: #define EX_THROW(EX,MSG,LINE) { assert((#EX": "MSG)==0); throw EX(MSG": "__FILE__":"#LINE); }
41: #define EX_THROW_QUIET(EX,MSG,LINE) { assert((#EX": "MSG)==0); throw EX(); }
42:
43: #define EX_BAD_CAST(MSG) EX_THROW_QUIET(bad_cast,MSG,__LINE__)
44: #define EX_INVALID_ARGUMENT(MSG) EX_THROW(invalid_argument,MSG,__LINE__)
45: #define EX_OUT_OF_RANGE(MSG) EX_THROW(out_of_range,MSG,__LINE__)
46: #define EX_MIND(MSG) EX_THROW(MindEx,MSG,__LINE__)
47:
48:
49:
50: /*****************
51: * *
52: * CLASS MINDEX *
53: * *
54: *****************/
55:
56:
57: class MindEx : public exception {
58: public:
59: MindEx(const char *ci_strWhat) { m_xtr = ci_strWhat; };
60: virtual const char *name(void) const { return "MindEx"; };
61: virtual const char *what(void) const throw () { return m_xtr.c_str(); };
62: ~MindEx(void) throw () { };
63: protected:
64: string m_xtr;
65: };
66:
67:
68: /*********************
69: * *
70: * CLASS BADPARSEEX *
71: * *
72: *********************/
73:
74:
75: class BadParseEx : public MindEx {
76: public:
77: BadParseEx(const char *ci_strWhat) : MindEx(ci_strWhat) {};
78: virtual const char* name(void) const { return "BadParseEx"; }
79: };
80:
81:
82: /*******************
83: * *
84: * CLASS BUFFEREX *
85: * *
86: *******************/
87:
88:
89: class BufferEx : public MindEx {
90: public:
91: BufferEx(const char *ci_strWhat) : MindEx(ci_strWhat) {};
92: virtual const char* name(void) const { return "BufferEx"; }
93: };
94:
95:
96: /*******************
97: * *
98: * CLASS CONFIGEX *
99: * *
100: *******************/
101:
102:
103: class ConfigEx : public MindEx {
104: public:
105: ConfigEx(const char *ci_strWhat) : MindEx(ci_strWhat) {};
106: virtual const char* name(void) const { return "ConfigEx"; }
107: };
108:
109:
110:
111:
112:
113: /************
114: * *
115: * THE END *
116: * *
117: ************/
118:
119:
120: #endif
121:
122:
123: