aboutsummaryrefslogtreecommitdiff
path: root/src/old/exceptionbase.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 04:50:36 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 04:50:36 +0000
commitda89e6d30e57bd6dbb10b4d36b093ce9bbf5c666 (patch)
tree0c8d31d13521011dc52a3fbadbf9e7e27929308f /src/old/exceptionbase.h
parentf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (diff)
downloadlibbu++-da89e6d30e57bd6dbb10b4d36b093ce9bbf5c666.tar.gz
libbu++-da89e6d30e57bd6dbb10b4d36b093ce9bbf5c666.tar.bz2
libbu++-da89e6d30e57bd6dbb10b4d36b093ce9bbf5c666.tar.xz
libbu++-da89e6d30e57bd6dbb10b4d36b093ce9bbf5c666.zip
The first batch seem to have made it alright. Unfortunately the Archive class
isn't done yet, I'm going to make it rely on streams, so those will be next, then we can make it work all sortsa' well.
Diffstat (limited to '')
-rw-r--r--src/old/exceptionbase.h105
1 files changed, 0 insertions, 105 deletions
diff --git a/src/old/exceptionbase.h b/src/old/exceptionbase.h
deleted file mode 100644
index 6f1eca7..0000000
--- a/src/old/exceptionbase.h
+++ /dev/null
@@ -1,105 +0,0 @@
1#ifndef EXCEPTION_BASE_H
2#define EXCEPTION_BASE_H
3
4#include <string>
5#include <exception>
6#include <stdarg.h>
7
8/**
9 * A generalized Exception base class. This is nice for making general and
10 * flexible child classes that can create new error code classes.
11 */
12class ExceptionBase : public std::exception
13{
14public:
15 /**
16 * Construct an exception with an error code of zero, but with a
17 * description. The use of this is not reccomended most of the time, it's
18 * generally best to include an error code with the exception so your
19 * program can handle the exception in a better way.
20 * @param sFormat The format of the text. See printf for more info.
21 */
22 ExceptionBase( const char *sFormat, ... ) throw();
23
24 /**
25 *
26 * @param nCode
27 * @param sFormat
28 */
29 ExceptionBase( int nCode, const char *sFormat, ... ) throw();
30
31 /**
32 *
33 * @param nCode
34 * @return
35 */
36 ExceptionBase( int nCode=0 ) throw();
37
38 /**
39 *
40 * @return
41 */
42 virtual ~ExceptionBase() throw();
43
44 /**
45 *
46 * @return
47 */
48 virtual const char *what() const throw();
49
50 /**
51 *
52 * @return
53 */
54 int getErrorCode();
55
56 /**
57 *
58 * @param lpFormat
59 * @param vargs
60 */
61 void setWhat( const char *lpFormat, va_list &vargs );
62
63 /**
64 *
65 * @param lpText
66 */
67 void setWhat( const char *lpText );
68
69private:
70 int nErrorCode; /**< The code for the error that occured. */
71 char *sWhat; /**< The text string telling people what went wrong. */
72};
73
74#define subExceptionDecl( name ) \
75class name : public ExceptionBase \
76{ \
77 public: \
78 name( const char *sFormat, ... ) throw (); \
79 name( int nCode, const char *sFormat, ... ) throw(); \
80 name( int nCode=0 ) throw (); \
81};
82
83#define subExceptionDef( name ) \
84name::name( const char *lpFormat, ... ) throw() : \
85 ExceptionBase( 0 ) \
86{ \
87 va_list ap; \
88 va_start( ap, lpFormat ); \
89 setWhat( lpFormat, ap ); \
90 va_end( ap ); \
91} \
92name::name( int nCode, const char *lpFormat, ... ) throw() : \
93 ExceptionBase( nCode ) \
94{ \
95 va_list ap; \
96 va_start( ap, lpFormat ); \
97 setWhat( lpFormat, ap ); \
98 va_end( ap ); \
99} \
100name::name( int nCode ) throw() : \
101 ExceptionBase( nCode ) \
102{ \
103}
104
105#endif