diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2006-07-26 19:09:50 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2006-07-26 19:09:50 +0000 |
| commit | 9e27762c2b4c1baf5b2aff003fbc56236fd742e6 (patch) | |
| tree | cd7256cea35b5a8dd7aefe3107c25a1681e83367 /src/exception.cpp | |
| parent | 2d0ffd6df450eb7cbc1e4dea841dcbf1ef9f9417 (diff) | |
| download | libbu++-9e27762c2b4c1baf5b2aff003fbc56236fd742e6.tar.gz libbu++-9e27762c2b4c1baf5b2aff003fbc56236fd742e6.tar.bz2 libbu++-9e27762c2b4c1baf5b2aff003fbc56236fd742e6.tar.xz libbu++-9e27762c2b4c1baf5b2aff003fbc56236fd742e6.zip | |
Partial update, don't use this release...
Diffstat (limited to 'src/exception.cpp')
| -rw-r--r-- | src/exception.cpp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/exception.cpp b/src/exception.cpp deleted file mode 100644 index 3cde134..0000000 --- a/src/exception.cpp +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | #include "exception.h" | ||
| 2 | #include <stdarg.h> | ||
| 3 | |||
| 4 | Exception::Exception( const char *lpFormat, ... ) throw() : | ||
| 5 | nErrorCode( 0 ), | ||
| 6 | sWhat( NULL ) | ||
| 7 | { | ||
| 8 | va_list ap; | ||
| 9 | |||
| 10 | va_start(ap, lpFormat); | ||
| 11 | setWhat( lpFormat, ap ); | ||
| 12 | va_end(ap); | ||
| 13 | } | ||
| 14 | |||
| 15 | Exception::Exception( int nCode, const char *lpFormat, ... ) throw() : | ||
| 16 | nErrorCode( nCode ), | ||
| 17 | sWhat( NULL ) | ||
| 18 | { | ||
| 19 | va_list ap; | ||
| 20 | |||
| 21 | va_start(ap, lpFormat); | ||
| 22 | setWhat( lpFormat, ap ); | ||
| 23 | va_end(ap); | ||
| 24 | } | ||
| 25 | |||
| 26 | Exception::Exception( int nCode ) throw() : | ||
| 27 | nErrorCode( nCode ), | ||
| 28 | sWhat( NULL ) | ||
| 29 | { | ||
| 30 | } | ||
| 31 | |||
| 32 | Exception::~Exception() throw() | ||
| 33 | { | ||
| 34 | if( sWhat ) | ||
| 35 | { | ||
| 36 | delete[] sWhat; | ||
| 37 | sWhat = NULL; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | void Exception::setWhat( const char *lpFormat, va_list &vargs ) | ||
| 42 | { | ||
| 43 | if( sWhat ) delete[] sWhat; | ||
| 44 | int nSize; | ||
| 45 | |||
| 46 | nSize = vsnprintf( NULL, 0, lpFormat, vargs ); | ||
| 47 | sWhat = new char[nSize+1]; | ||
| 48 | vsnprintf( sWhat, nSize+1, lpFormat, vargs ); | ||
| 49 | } | ||
| 50 | |||
| 51 | const char *Exception::what() const throw() | ||
| 52 | { | ||
| 53 | return sWhat; | ||
| 54 | } | ||
| 55 | |||
| 56 | int Exception::getErrorCode() | ||
| 57 | { | ||
| 58 | return nErrorCode; | ||
| 59 | } | ||
| 60 | |||
