summaryrefslogtreecommitdiff
path: root/src/stable/exceptionbase.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/stable/exceptionbase.cpp
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/stable/exceptionbase.cpp')
-rw-r--r--src/stable/exceptionbase.cpp76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/stable/exceptionbase.cpp b/src/stable/exceptionbase.cpp
index 87e7127..22f338f 100644
--- a/src/stable/exceptionbase.cpp
+++ b/src/stable/exceptionbase.cpp
@@ -11,83 +11,83 @@
11#include <stdio.h> 11#include <stdio.h>
12 12
13Bu::ExceptionBase::ExceptionBase( const char *lpFormat, ... ) throw() : 13Bu::ExceptionBase::ExceptionBase( const char *lpFormat, ... ) throw() :
14 nErrorCode( 0 ), 14 nErrorCode( 0 ),
15 sWhat( NULL ) 15 sWhat( NULL )
16{ 16{
17 va_list ap; 17 va_list ap;
18 18
19 va_start(ap, lpFormat); 19 va_start(ap, lpFormat);
20 setWhat( lpFormat, ap ); 20 setWhat( lpFormat, ap );
21 va_end(ap); 21 va_end(ap);
22} 22}
23 23
24Bu::ExceptionBase::ExceptionBase( int nCode, const char *lpFormat, ... ) throw() : 24Bu::ExceptionBase::ExceptionBase( int nCode, const char *lpFormat, ... ) throw() :
25 nErrorCode( nCode ), 25 nErrorCode( nCode ),
26 sWhat( NULL ) 26 sWhat( NULL )
27{ 27{
28 va_list ap; 28 va_list ap;
29 29
30 va_start(ap, lpFormat); 30 va_start(ap, lpFormat);
31 setWhat( lpFormat, ap ); 31 setWhat( lpFormat, ap );
32 va_end(ap); 32 va_end(ap);
33} 33}
34 34
35Bu::ExceptionBase::ExceptionBase( int nCode ) throw() : 35Bu::ExceptionBase::ExceptionBase( int nCode ) throw() :
36 nErrorCode( nCode ), 36 nErrorCode( nCode ),
37 sWhat( NULL ) 37 sWhat( NULL )
38{ 38{
39} 39}
40 40
41Bu::ExceptionBase::ExceptionBase( const ExceptionBase &e ) throw () : 41Bu::ExceptionBase::ExceptionBase( const ExceptionBase &e ) throw () :
42 std::exception( e ), 42 std::exception( e ),
43 nErrorCode( e.nErrorCode ), 43 nErrorCode( e.nErrorCode ),
44 sWhat( NULL ) 44 sWhat( NULL )
45{ 45{
46 setWhat( e.sWhat ); 46 setWhat( e.sWhat );
47} 47}
48 48
49Bu::ExceptionBase::~ExceptionBase() throw() 49Bu::ExceptionBase::~ExceptionBase() throw()
50{ 50{
51 delete[] sWhat; 51 delete[] sWhat;
52 sWhat = NULL; 52 sWhat = NULL;
53} 53}
54 54
55void Bu::ExceptionBase::setWhat( const char *lpFormat, va_list &vargs ) 55void Bu::ExceptionBase::setWhat( const char *lpFormat, va_list &vargs )
56{ 56{
57 if( sWhat ) delete[] sWhat; 57 if( sWhat ) delete[] sWhat;
58 int nSize; 58 int nSize;
59 59
60 va_list vargs2; 60 va_list vargs2;
61 va_copy( vargs2, vargs ); 61 va_copy( vargs2, vargs );
62 nSize = vsnprintf( NULL, 0, lpFormat, vargs2 ); 62 nSize = vsnprintf( NULL, 0, lpFormat, vargs2 );
63 va_end( vargs2 ); 63 va_end( vargs2 );
64 sWhat = new char[nSize+1]; 64 sWhat = new char[nSize+1];
65 vsnprintf( sWhat, nSize+1, lpFormat, vargs ); 65 vsnprintf( sWhat, nSize+1, lpFormat, vargs );
66} 66}
67 67
68void Bu::ExceptionBase::setWhat( const char *lpText ) 68void Bu::ExceptionBase::setWhat( const char *lpText )
69{ 69{
70 if( sWhat ) delete[] sWhat; 70 if( sWhat ) delete[] sWhat;
71 int nSize; 71 int nSize;
72 72
73 nSize = strlen( lpText ); 73 nSize = strlen( lpText );
74 sWhat = new char[nSize+1]; 74 sWhat = new char[nSize+1];
75 strcpy( sWhat, lpText ); 75 strcpy( sWhat, lpText );
76} 76}
77 77
78const char *Bu::ExceptionBase::what() const throw() 78const char *Bu::ExceptionBase::what() const throw()
79{ 79{
80 return sWhat; 80 return sWhat;
81} 81}
82 82
83int Bu::ExceptionBase::getErrorCode() 83int Bu::ExceptionBase::getErrorCode()
84{ 84{
85 return nErrorCode; 85 return nErrorCode;
86} 86}
87 87
88Bu::UnsupportedException::UnsupportedException() throw() : 88Bu::UnsupportedException::UnsupportedException() throw() :
89 ExceptionBase( 0 ) 89 ExceptionBase( 0 )
90{ 90{
91 setWhat("An unsupperted operation was attempted."); 91 setWhat("An unsupperted operation was attempted.");
92} 92}
93 93