From 603f45fbe9c3e0ac511425a13bbb19b87495bb4e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 27 Jan 2007 08:43:21 +0000 Subject: Added a function to make the Base Exception class a little friendlier. --- src/exceptionbase.cpp | 10 ++++++++++ src/exceptionbase.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/exceptionbase.cpp b/src/exceptionbase.cpp index a9b9820..f3d22da 100644 --- a/src/exceptionbase.cpp +++ b/src/exceptionbase.cpp @@ -48,6 +48,16 @@ void ExceptionBase::setWhat( const char *lpFormat, va_list &vargs ) vsnprintf( sWhat, nSize+1, lpFormat, vargs ); } +void ExceptionBase::setWhat( const char *lpText ) +{ + if( sWhat ) delete[] sWhat; + int nSize; + + nSize = strlen( lpText ); + sWhat = new char[nSize+1]; + strcpy( sWhat, lpText ); +} + const char *ExceptionBase::what() const throw() { return sWhat; diff --git a/src/exceptionbase.h b/src/exceptionbase.h index 7c3cbd9..6f1eca7 100644 --- a/src/exceptionbase.h +++ b/src/exceptionbase.h @@ -60,6 +60,12 @@ public: */ void setWhat( const char *lpFormat, va_list &vargs ); + /** + * + * @param lpText + */ + void setWhat( const char *lpText ); + private: int nErrorCode; /**< The code for the error that occured. */ char *sWhat; /**< The text string telling people what went wrong. */ -- cgit v1.2.3