exceptions.h

Go to the documentation of this file.
00001 
00019 #ifndef __EXCEPTIONS_H__
00020 #define __EXCEPTIONS_H__
00021 
00022 #include <exception> /* std::exception */
00023 #include <stdexcept> /* standard exceptions */
00024 #include <typeinfo>  /* std::type_info */
00025 #include <new>       /* std::bad_alloc */
00026 
00027 #include "common.h"
00028 
00029 using std::exception;
00030 using std::string;
00031 
00035 class Exception: public exception {
00036 public:
00044         explicit Exception(const string & errMessage = "",
00045                 const char * fileName = "",
00046                 int lineNumber = 0,
00047                 const char * funcName = ""):
00048                 message(errMessage), file(fileName), line(lineNumber), func(funcName) {}
00049 
00053         virtual ~Exception() throw() {}
00054 
00060         // Small 'w' is here because std::exception has this method named 'what'
00061         virtual const char * what() throw()     {
00062                 return message.c_str();
00063         }
00064 
00068         virtual void PrintErr() const;
00069 
00073         virtual void ShowErrWindow() const;
00074 
00082          virtual void ShowError() const;
00083 
00091         virtual const char * GetExceptionName() const {
00092                 return typeid(*this).name();
00093         }
00094 
00102          static void ShowStdExceptionErr(const exception & stdException);
00103 
00104 private:
00106         const string message;
00108         const string file;
00110         const int line;
00112         const string func;
00113 };
00114 
00119 class ExceptionUnknown: public Exception {
00120 public:
00122         ExceptionUnknown(const string & errMessage = "",
00123                 const char * fileName = "",
00124                 int lineNumber = 0,
00125                 const char * funcName = ""):
00126                 Exception(errMessage, fileName, lineNumber, funcName) {}
00127 };
00128 
00130 
00134 class ExceptionMatrix: public Exception {
00135 public:
00137         ExceptionMatrix(const string & errMessage = "",
00138                 const char * fileName = "",
00139                 int lineNumber = 0,
00140                 const char * funcName = ""):
00141                 Exception(errMessage, fileName, lineNumber, funcName) {}
00142 };
00143 
00147 class ExceptionMatrixInvalidSize: public ExceptionMatrix {
00148 public:
00150         ExceptionMatrixInvalidSize(const string & errMessage = "",
00151                 const char * fileName = "",
00152                 int lineNumber = 0,
00153                 const char * funcName = ""):
00154                 ExceptionMatrix(errMessage, fileName, lineNumber, funcName) {}
00155 };
00156 
00160 class ExceptionMatrixOutOfRange: public ExceptionMatrix {
00161 public:
00163         ExceptionMatrixOutOfRange(const string & errMessage = "",
00164                 const char * fileName = "",
00165                 int lineNumber = 0,
00166                 const char * funcName = ""):
00167                 ExceptionMatrix(errMessage, fileName, lineNumber, funcName) {}
00168 };
00169 
00173 class ExceptionMatrixUnexpectedObjectType: public ExceptionMatrix {
00174 public:
00176         ExceptionMatrixUnexpectedObjectType(const string & errMessage = "",
00177                 const char * fileName = "",
00178                 int lineNumber = 0,
00179                 const char * funcName = ""):
00180                 ExceptionMatrix(errMessage, fileName, lineNumber, funcName) {}
00181 };
00182 
00183 
00185 
00189 class ExceptionGUI: public Exception {
00190 public:
00192         ExceptionGUI(const string & errMessage = "",
00193                 const char * fileName = "",
00194                 int lineNumber = 0,
00195                 const char * funcName = ""):
00196                 Exception(errMessage, fileName, lineNumber, funcName) {}
00197 };
00198 
00202 class ExceptionGUIImage: public ExceptionGUI {
00203 public:
00205         ExceptionGUIImage(const string & errMessage = "",
00206                 const char * fileName = "",
00207                 int lineNumber = 0,
00208                 const char * funcName = ""):
00209                 ExceptionGUI(errMessage, fileName, lineNumber, funcName) {}
00210 };
00211 
00213 
00217 class ExceptionObject: public Exception {
00218 public:
00220         ExceptionObject(const string & errMessage = "",
00221                 const char * fileName = "",
00222                 int lineNumber = 0,
00223                 const char * funcName = ""):
00224                 Exception(errMessage, fileName, lineNumber, funcName) {}
00225 };
00226 
00230 class ExceptionObjectBadAction: public ExceptionObject {
00231 public:
00233         ExceptionObjectBadAction(const string & errMessage = "",
00234                 const char * fileName = "",
00235                 int lineNumber = 0,
00236                 const char * funcName = ""):
00237                 ExceptionObject(errMessage, fileName, lineNumber, funcName) {}
00238 };
00239 
00241 
00245 class ExceptionInterpreter: public Exception {
00246 public:
00248         ExceptionInterpreter(const string & errMessage = "",
00249                 const char * fileName = "",
00250                 int lineNumber = 0,
00251                 const char * funcName = ""):
00252                 Exception(errMessage, fileName, lineNumber, funcName) {}
00253 };
00254 
00258 class ExceptionInterpreterScript: public ExceptionInterpreter {
00259 public:
00261         ExceptionInterpreterScript(const string & errMessage = "",
00262                 const char * fileName = "",
00263                 int lineNumber = 0,
00264                 const char * funcName = ""):
00265                 ExceptionInterpreter(errMessage, fileName, lineNumber, funcName) {}
00266 };
00267 
00269 
00273 class ExceptionConfig: public Exception {
00274 public:
00276         ExceptionConfig(const string & errMessage = "",
00277                 const char * fileName = "",
00278                 int lineNumber = 0,
00279                 const char * funcName = ""):
00280                 Exception(errMessage, fileName, lineNumber, funcName) {}
00281 };
00282 
00286 class ExceptionConfigBadType: public ExceptionConfig {
00287 public:
00289         ExceptionConfigBadType(const string & errMessage = "",
00290                 const char * fileName = "",
00291                 int lineNumber = 0,
00292                 const char * funcName = ""):
00293                 ExceptionConfig(errMessage, fileName, lineNumber, funcName) {}
00294 };
00295 
00299 class ExceptionConfigBadFile: public ExceptionConfig {
00300 public:
00302         ExceptionConfigBadFile(const string & errMessage = "",
00303                 const char * fileName = "",
00304                 int lineNumber = 0,
00305                 const char * funcName = ""):
00306                 ExceptionConfig(errMessage, fileName, lineNumber, funcName) {}
00307 };
00308 
00313 class ExceptionConfigBadMode: public ExceptionConfig {
00314 public:
00316         ExceptionConfigBadMode(const string & errMessage = "",
00317                 const char * fileName = "",
00318                 int lineNumber = 0,
00319                 const char * funcName = ""):
00320                 ExceptionConfig(errMessage, fileName, lineNumber, funcName) {}
00321 };
00322 
00326 class ExceptionConfigMatrixNoCells: public ExceptionConfig {
00327 public:
00329         ExceptionConfigMatrixNoCells(const string & errMessage = "",
00330                 const char * fileName = "",
00331                 int lineNumber = 0,
00332                 const char * funcName = ""):
00333                 ExceptionConfig(errMessage, fileName, lineNumber, funcName) {}
00334 };
00335 
00339 class ExceptionConfigBadData: public ExceptionConfig {
00340 public:
00342         ExceptionConfigBadData(const string & errMessage = "",
00343                 const char * fileName = "",
00344                 int lineNumber = 0,
00345                 const char * funcName = ""):
00346                 ExceptionConfig(errMessage, fileName, lineNumber, funcName) {}
00347 };
00351 class ExceptionConfigBadAction: public ExceptionConfig {
00352 public:
00354         ExceptionConfigBadAction(const string & errMessage = "",
00355                 const char * fileName = "",
00356                 int lineNumber = 0,
00357                 const char * funcName = ""):
00358                 ExceptionConfig(errMessage, fileName, lineNumber, funcName) {}
00359 };
00360 
00362 
00366 class ExceptionFactory: public Exception {
00367 public:
00369         ExceptionFactory(const string & errMessage = "",
00370                 const char * fileName = "",
00371                 int lineNumber = 0,
00372                 const char * funcName = ""):
00373                 Exception(errMessage, fileName, lineNumber, funcName) {}
00374 };
00375 
00379 class ExceptionFactoryObjects: public ExceptionFactory {
00380 public:
00382         ExceptionFactoryObjects(const string & errMessage = "",
00383                 const char * fileName = "",
00384                 int lineNumber = 0,
00385                 const char * funcName = ""):
00386                 ExceptionFactory(errMessage, fileName, lineNumber, funcName) {}
00387 };
00388 
00392 class ExceptionFactoryObjectConfigs: public ExceptionFactory {
00393 public:
00395         ExceptionFactoryObjectConfigs(const string & errMessage = "",
00396                 const char * fileName = "",
00397                 int lineNumber = 0,
00398                 const char * funcName = ""):
00399                 ExceptionFactory(errMessage, fileName, lineNumber, funcName) {}
00400 };
00401 
00403 
00407 class ExceptionBadDirection: public Exception {
00408 public:
00410         ExceptionBadDirection(const string & errMessage = "",
00411                 const char * fileName = "",
00412                 int lineNumber = 0,
00413                 const char * funcName = ""):
00414                 Exception(errMessage, fileName, lineNumber, funcName) {}
00415 };
00416 
00417 #endif /* #ifndef __EXCEPTIONS_H__ */
00418 
00419 /* End of file exceptions.h */

Generated on Sun Apr 29 11:46:10 2007 for IPP/ICP2007 by  doxygen 1.4.7