Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _YAPETEXCEPTION_H
00034 #define _YAPETEXCEPTION_H
00035
00036 #ifdef HAVE_CONFIG_H
00037 # include <config.h>
00038 #endif
00039
00040 #ifdef HAVE_EXCEPTION
00041 # include <exception>
00042 #endif
00043
00044 #ifdef HAVE_STRING
00045 # include <string>
00046 #endif
00047
00048 #include "../intl.h"
00049
00050 namespace YAPET {
00051
00060 enum EXNUM {
00061 BDBUFFER_TOO_SMALL = 1,
00062 BDBUFFER_TOO_BIG = 2,
00063 NULLPOINTER = 3,
00064 NOTUSED = 255
00065 };
00066
00074 class YAPETException : public std::exception {
00075 private:
00076 EXNUM exnum;
00077 std::string message;
00078
00079 protected:
00080 inline void setExNum(EXNUM n) { exnum = n ; }
00081 public:
00087 inline YAPETException()
00088 throw() : exception(),
00089 exnum(NOTUSED),
00090 message (_ ("Generic exception message") ) {}
00098 inline YAPETException (std::string msg) throw() : exception(),
00099 exnum(NOTUSED),
00100 message (msg) {}
00101 inline YAPETException (std::string msg, EXNUM n) throw() : exception(),
00102 exnum(n),
00103 message (msg) {}
00104 inline YAPETException (const YAPETException& ex) throw() {
00105 exnum = ex.exnum;
00106 message = ex.message;
00107 }
00108 inline virtual ~YAPETException() throw() { }
00109 inline const YAPETException& operator= (const YAPETException& ex)
00110 throw() {
00111 if (this == &ex) return *this;
00112
00113 exnum = ex.exnum;
00114 message = ex.message;
00115 return *this;
00116 }
00117 inline virtual const char* what() const throw() {
00118 return message.c_str();
00119 }
00120 inline EXNUM getExNum() const throw() { return exnum; }
00121 };
00122
00131 class YAPETRetryException : public YAPETException {
00132 public:
00133 inline YAPETRetryException()
00134 throw() : YAPETException (_ ("Retry") ) {}
00135 inline YAPETRetryException (std::string msg)
00136 throw() : YAPETException (msg) {}
00137 inline YAPETRetryException (const YAPETRetryException& ex)
00138 throw() : YAPETException (ex) {}
00139 inline virtual ~YAPETRetryException() throw() { }
00140
00141 inline const YAPETRetryException
00142 operator= (const YAPETRetryException& ex) throw() {
00143 if (this == &ex) return *this;
00144
00145 YAPETException::operator= (ex);
00146 return *this;
00147 }
00148 };
00149
00156 class YAPETEncryptionException : public YAPETException {
00157 public:
00158 inline YAPETEncryptionException()
00159 throw() : YAPETException (_ ("Encryption error") ) {}
00160 inline YAPETEncryptionException (std::string msg)
00161 throw() : YAPETException (msg) {}
00162 inline YAPETEncryptionException (const YAPETEncryptionException& ex)
00163 throw() : YAPETException (ex) {}
00164 inline virtual ~YAPETEncryptionException() throw() { }
00165
00166 inline const YAPETEncryptionException
00167 operator= (const YAPETEncryptionException& ex) throw() {
00168 if (this == &ex) return *this;
00169
00170 YAPETException::operator= (ex);
00171 return *this;
00172 }
00173 };
00174
00183 class YAPETInvalidPasswordException : public YAPETException {
00184 public:
00185 inline YAPETInvalidPasswordException()
00186 throw() : YAPETException (_ ("Invalid password") ) {}
00187 inline YAPETInvalidPasswordException (std::string msg)
00188 throw() : YAPETException (msg) {}
00189
00190 inline
00191 YAPETInvalidPasswordException (const YAPETInvalidPasswordException& ex)
00192 throw() : YAPETException (ex) {}
00193 inline virtual ~YAPETInvalidPasswordException()
00194 throw() { }
00195
00196 inline const YAPETInvalidPasswordException
00197 operator= (const YAPETInvalidPasswordException& ex) throw() {
00198 if (this == &ex) return *this;
00199
00200 YAPETException::operator= (ex);
00201 return *this;
00202 }
00203 };
00204
00205 }
00206
00207 #endif // _YAPETEXCEPTION_H