aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/exceptionbase.cpp16
-rw-r--r--src/exceptionbase.h (renamed from src/exception.h)22
-rw-r--r--src/exceptions.cpp5
-rw-r--r--src/exceptions.h9
-rw-r--r--src/xmlexception.cpp31
-rw-r--r--src/xmlexception.h21
-rw-r--r--src/xmlfilereader.cpp2
-rw-r--r--src/xmlreader.cpp2
-rw-r--r--src/xmlstringreader.cpp2
9 files changed, 36 insertions, 74 deletions
diff --git a/src/exceptionbase.cpp b/src/exceptionbase.cpp
index 3cde134..a9b9820 100644
--- a/src/exceptionbase.cpp
+++ b/src/exceptionbase.cpp
@@ -1,7 +1,7 @@
1#include "exception.h" 1#include "exceptionbase.h"
2#include <stdarg.h> 2#include <stdarg.h>
3 3
4Exception::Exception( const char *lpFormat, ... ) throw() : 4ExceptionBase::ExceptionBase( const char *lpFormat, ... ) throw() :
5 nErrorCode( 0 ), 5 nErrorCode( 0 ),
6 sWhat( NULL ) 6 sWhat( NULL )
7{ 7{
@@ -12,7 +12,7 @@ Exception::Exception( const char *lpFormat, ... ) throw() :
12 va_end(ap); 12 va_end(ap);
13} 13}
14 14
15Exception::Exception( int nCode, const char *lpFormat, ... ) throw() : 15ExceptionBase::ExceptionBase( int nCode, const char *lpFormat, ... ) throw() :
16 nErrorCode( nCode ), 16 nErrorCode( nCode ),
17 sWhat( NULL ) 17 sWhat( NULL )
18{ 18{
@@ -23,13 +23,13 @@ Exception::Exception( int nCode, const char *lpFormat, ... ) throw() :
23 va_end(ap); 23 va_end(ap);
24} 24}
25 25
26Exception::Exception( int nCode ) throw() : 26ExceptionBase::ExceptionBase( int nCode ) throw() :
27 nErrorCode( nCode ), 27 nErrorCode( nCode ),
28 sWhat( NULL ) 28 sWhat( NULL )
29{ 29{
30} 30}
31 31
32Exception::~Exception() throw() 32ExceptionBase::~ExceptionBase() throw()
33{ 33{
34 if( sWhat ) 34 if( sWhat )
35 { 35 {
@@ -38,7 +38,7 @@ Exception::~Exception() throw()
38 } 38 }
39} 39}
40 40
41void Exception::setWhat( const char *lpFormat, va_list &vargs ) 41void ExceptionBase::setWhat( const char *lpFormat, va_list &vargs )
42{ 42{
43 if( sWhat ) delete[] sWhat; 43 if( sWhat ) delete[] sWhat;
44 int nSize; 44 int nSize;
@@ -48,12 +48,12 @@ void Exception::setWhat( const char *lpFormat, va_list &vargs )
48 vsnprintf( sWhat, nSize+1, lpFormat, vargs ); 48 vsnprintf( sWhat, nSize+1, lpFormat, vargs );
49} 49}
50 50
51const char *Exception::what() const throw() 51const char *ExceptionBase::what() const throw()
52{ 52{
53 return sWhat; 53 return sWhat;
54} 54}
55 55
56int Exception::getErrorCode() 56int ExceptionBase::getErrorCode()
57{ 57{
58 return nErrorCode; 58 return nErrorCode;
59} 59}
diff --git a/src/exception.h b/src/exceptionbase.h
index 1234bef..c0ced37 100644
--- a/src/exception.h
+++ b/src/exceptionbase.h
@@ -1,5 +1,5 @@
1#ifndef EXCEPTION_H 1#ifndef EXCEPTION_BASE_H
2#define EXCEPTION_H 2#define EXCEPTION_BASE_H
3 3
4#include <string> 4#include <string>
5#include <exception> 5#include <exception>
@@ -9,7 +9,7 @@
9 * A generalized Exception base class. This is nice for making general and 9 * A generalized Exception base class. This is nice for making general and
10 * flexible child classes that can create new error code classes. 10 * flexible child classes that can create new error code classes.
11 */ 11 */
12class Exception : public std::exception 12class ExceptionBase : public std::exception
13{ 13{
14public: 14public:
15 /** 15 /**
@@ -19,27 +19,27 @@ public:
19 * program can handle the exception in a better way. 19 * program can handle the exception in a better way.
20 * @param sFormat The format of the text. See printf for more info. 20 * @param sFormat The format of the text. See printf for more info.
21 */ 21 */
22 Exception( const char *sFormat, ... ) throw(); 22 ExceptionBase( const char *sFormat, ... ) throw();
23 23
24 /** 24 /**
25 * 25 *
26 * @param nCode 26 * @param nCode
27 * @param sFormat 27 * @param sFormat
28 */ 28 */
29 Exception( int nCode, const char *sFormat, ... ) throw(); 29 ExceptionBase( int nCode, const char *sFormat, ... ) throw();
30 30
31 /** 31 /**
32 * 32 *
33 * @param nCode 33 * @param nCode
34 * @return 34 * @return
35 */ 35 */
36 Exception( int nCode=0 ) throw(); 36 ExceptionBase( int nCode=0 ) throw();
37 37
38 /** 38 /**
39 * 39 *
40 * @return 40 * @return
41 */ 41 */
42 virtual ~Exception() throw(); 42 virtual ~ExceptionBase() throw();
43 43
44 /** 44 /**
45 * 45 *
@@ -66,7 +66,7 @@ private:
66}; 66};
67 67
68#define subExceptionDecl( name ) \ 68#define subExceptionDecl( name ) \
69class name : public Exception \ 69class name : public ExceptionBase \
70{ \ 70{ \
71 public: \ 71 public: \
72 name( const char *sFormat, ... ) throw (); \ 72 name( const char *sFormat, ... ) throw (); \
@@ -76,7 +76,7 @@ class name : public Exception \
76 76
77#define subExceptionDef( name ) \ 77#define subExceptionDef( name ) \
78name::name( const char *lpFormat, ... ) throw() : \ 78name::name( const char *lpFormat, ... ) throw() : \
79 Exception( 0 ) \ 79 ExceptionBase( 0 ) \
80{ \ 80{ \
81 va_list ap; \ 81 va_list ap; \
82 va_start( ap, lpFormat ); \ 82 va_start( ap, lpFormat ); \
@@ -84,7 +84,7 @@ name::name( const char *lpFormat, ... ) throw() : \
84 va_end( ap ); \ 84 va_end( ap ); \
85} \ 85} \
86name::name( int nCode, const char *lpFormat, ... ) throw() : \ 86name::name( int nCode, const char *lpFormat, ... ) throw() : \
87 Exception( nCode ) \ 87 ExceptionBase( nCode ) \
88{ \ 88{ \
89 va_list ap; \ 89 va_list ap; \
90 va_start( ap, lpFormat ); \ 90 va_start( ap, lpFormat ); \
@@ -92,7 +92,7 @@ name::name( int nCode, const char *lpFormat, ... ) throw() : \
92 va_end( ap ); \ 92 va_end( ap ); \
93} \ 93} \
94name::name( int nCode ) throw() : \ 94name::name( int nCode ) throw() : \
95 Exception( nCode ) \ 95 ExceptionBase( nCode ) \
96{ \ 96{ \
97} 97}
98 98
diff --git a/src/exceptions.cpp b/src/exceptions.cpp
new file mode 100644
index 0000000..441075d
--- /dev/null
+++ b/src/exceptions.cpp
@@ -0,0 +1,5 @@
1#include "exceptions.h"
2#include <stdarg.h>
3
4subExceptionDef( XmlException )
5
diff --git a/src/exceptions.h b/src/exceptions.h
new file mode 100644
index 0000000..1cc891d
--- /dev/null
+++ b/src/exceptions.h
@@ -0,0 +1,9 @@
1#ifndef EXCEPTIONS_H
2#define EXCEPTIONS_H
3
4#include "exceptionbase.h"
5#include <stdarg.h>
6
7subExceptionDecl( XmlException )
8
9#endif
diff --git a/src/xmlexception.cpp b/src/xmlexception.cpp
deleted file mode 100644
index 9f38844..0000000
--- a/src/xmlexception.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
1#include "xmlexception.h"
2#include <stdarg.h>
3
4subExceptionDef( XmlException )
5
6/*
7XmlException::XmlException( const char *lpFormat, ... ) throw() :
8 Exception( 0 )
9{
10 va_list ap;
11
12 va_start(ap, lpFormat);
13 setWhat( lpFormat, ap );
14 va_end(ap);
15}
16
17XmlException::XmlException( int nCode, const char *lpFormat, ... ) throw() :
18 Exception( nCode )
19{
20 va_list ap;
21
22 va_start(ap, lpFormat);
23 setWhat( lpFormat, ap );
24 va_end(ap);
25}
26
27XmlException::XmlException( int nCode ) throw() :
28 Exception( nCode )
29{
30}
31*/
diff --git a/src/xmlexception.h b/src/xmlexception.h
deleted file mode 100644
index 5cbeda7..0000000
--- a/src/xmlexception.h
+++ /dev/null
@@ -1,21 +0,0 @@
1#ifndef XML_EXCEPTION_H
2#define XML_EXCEPTION_H
3
4#include <string>
5#include "exception.h"
6#include <stdarg.h>
7
8subExceptionDecl( XmlException )
9
10/*
11class XmlException : public Exception
12{
13public:
14 XmlException( const char *sFormat, ... ) throw();
15
16 XmlException( int nCode, const char *sFormat, ... ) throw();
17
18 XmlException( int nCode=0 ) throw();
19};*/
20
21#endif
diff --git a/src/xmlfilereader.cpp b/src/xmlfilereader.cpp
index eb0ff9c..ed674a8 100644
--- a/src/xmlfilereader.cpp
+++ b/src/xmlfilereader.cpp
@@ -1,5 +1,5 @@
1#include "xmlfilereader.h" 1#include "xmlfilereader.h"
2#include "xmlexception.h" 2#include "exceptions.h"
3#include <string.h> 3#include <string.h>
4 4
5XmlFileReader::XmlFileReader( const char *sFile, bool bStrip ) 5XmlFileReader::XmlFileReader( const char *sFile, bool bStrip )
diff --git a/src/xmlreader.cpp b/src/xmlreader.cpp
index 2a5f63f..d51568c 100644
--- a/src/xmlreader.cpp
+++ b/src/xmlreader.cpp
@@ -1,5 +1,5 @@
1#include "xmlreader.h" 1#include "xmlreader.h"
2#include "xmlexception.h" 2#include "exceptions.h"
3#include <string.h> 3#include <string.h>
4#include "hashfunctionstring.h" 4#include "hashfunctionstring.h"
5 5
diff --git a/src/xmlstringreader.cpp b/src/xmlstringreader.cpp
index 211df78..3956ff3 100644
--- a/src/xmlstringreader.cpp
+++ b/src/xmlstringreader.cpp
@@ -1,5 +1,5 @@
1#include "xmlstringreader.h" 1#include "xmlstringreader.h"
2#include "xmlexception.h" 2#include "exceptions.h"
3#include <string.h> 3#include <string.h>
4 4
5XmlStringReader::XmlStringReader( const char *sString, bool bStrip ) 5XmlStringReader::XmlStringReader( const char *sString, bool bStrip )