From 579c3ac445043122b0a702bdb2542d9ea404b62e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 26 Jul 2006 19:16:58 +0000 Subject: Exceptions have been re-worked, and are easier to use, and don't collide with system includues anymore. --- src/exception.h | 99 --------------------------------------------------------- 1 file changed, 99 deletions(-) delete mode 100644 src/exception.h (limited to 'src/exception.h') diff --git a/src/exception.h b/src/exception.h deleted file mode 100644 index 1234bef..0000000 --- a/src/exception.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef EXCEPTION_H -#define EXCEPTION_H - -#include -#include -#include - -/** - * A generalized Exception base class. This is nice for making general and - * flexible child classes that can create new error code classes. - */ -class Exception : public std::exception -{ -public: - /** - * Construct an exception with an error code of zero, but with a - * description. The use of this is not reccomended most of the time, it's - * generally best to include an error code with the exception so your - * program can handle the exception in a better way. - * @param sFormat The format of the text. See printf for more info. - */ - Exception( const char *sFormat, ... ) throw(); - - /** - * - * @param nCode - * @param sFormat - */ - Exception( int nCode, const char *sFormat, ... ) throw(); - - /** - * - * @param nCode - * @return - */ - Exception( int nCode=0 ) throw(); - - /** - * - * @return - */ - virtual ~Exception() throw(); - - /** - * - * @return - */ - virtual const char *what() const throw(); - - /** - * - * @return - */ - int getErrorCode(); - - /** - * - * @param lpFormat - * @param vargs - */ - void setWhat( const char *lpFormat, va_list &vargs ); - -private: - char *sWhat; /**< The text string telling people what went wrong. */ - int nErrorCode; /**< The code for the error that occured. */ -}; - -#define subExceptionDecl( name ) \ -class name : public Exception \ -{ \ - public: \ - name( const char *sFormat, ... ) throw (); \ - name( int nCode, const char *sFormat, ... ) throw(); \ - name( int nCode=0 ) throw (); \ -}; - -#define subExceptionDef( name ) \ -name::name( const char *lpFormat, ... ) throw() : \ - Exception( 0 ) \ -{ \ - va_list ap; \ - va_start( ap, lpFormat ); \ - setWhat( lpFormat, ap ); \ - va_end( ap ); \ -} \ -name::name( int nCode, const char *lpFormat, ... ) throw() : \ - Exception( nCode ) \ -{ \ - va_list ap; \ - va_start( ap, lpFormat ); \ - setWhat( lpFormat, ap ); \ - va_end( ap ); \ -} \ -name::name( int nCode ) throw() : \ - Exception( nCode ) \ -{ \ -} - -#endif -- cgit v1.2.3