author | Michael Krelin <hacker@klever.net> | 2008-04-05 11:17:33 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-04-05 11:17:33 (UTC) |
commit | 04fb190243442e83349f129b523ab747e58100bf (patch) (unidiff) | |
tree | ddc28357fbe78b07fd3a5e0aa8088130bf305829 /include/napkin/exception.h | |
download | napkin-0.0.zip napkin-0.0.tar.gz napkin-0.0.tar.bz2 |
Initial commit into public repository0.0
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/napkin/exception.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/napkin/exception.h b/include/napkin/exception.h new file mode 100644 index 0000000..b317886 --- a/dev/null +++ b/include/napkin/exception.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef __NAPKIN_EXCEPTION_H | ||
2 | #define __NAPKIN_EXCEPTION_H | ||
3 | |||
4 | #include <stdexcept> | ||
5 | #include <string> | ||
6 | |||
7 | #defineNAPKIN_E_SUBCLASS(derived,base) \ | ||
8 | class derived : public base { \ | ||
9 | public: \ | ||
10 | explicit derived(const string& w) \ | ||
11 | : base(w) { } \ | ||
12 | } | ||
13 | |||
14 | namespace napkin { | ||
15 | using std::string; | ||
16 | |||
17 | class exception : public std::runtime_error { | ||
18 | public: | ||
19 | explicit exception(const string& w) | ||
20 | : std::runtime_error(w) { } | ||
21 | ~exception() throw() { } | ||
22 | }; | ||
23 | |||
24 | NAPKIN_E_SUBCLASS(exception_sleeptracker,exception); | ||
25 | NAPKIN_E_SUBCLASS(exception_st_port,exception_sleeptracker); | ||
26 | NAPKIN_E_SUBCLASS(exception_st_data,exception_sleeptracker); | ||
27 | NAPKIN_E_SUBCLASS(exception_st_data_envelope,exception_st_data); | ||
28 | NAPKIN_E_SUBCLASS(exception_st_data_integrity,exception_st_data_envelope); | ||
29 | |||
30 | NAPKIN_E_SUBCLASS(exception_db,exception); | ||
31 | NAPKIN_E_SUBCLASS(exception_db_already,exception_db); | ||
32 | } | ||
33 | |||
34 | #undef NAPKIN_E_SUBCLASS | ||
35 | |||
36 | #endif /* __NAPKIN_EXCEPTION_H */ | ||