![]() |
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * Enhanced Exception usage * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 2003 by Mathew Robertson. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 *********************************************************************************/ 00022 #ifndef FXEXTENDEDEXCEPTION_H 00023 #define FXEXTENDEDEXCEPTION_H 00024 00025 #ifndef FXEXCEPTION_H 00026 #include <fox/FXException.h> 00027 using namespace FX; 00028 #endif 00029 namespace FXEX { 00030 class FXExtendedException; 00031 00032 /** 00033 * Extended exception class heirachy + some helper functions 00034 */ 00035 00036 /// show an exception description using a dialog box 00037 void show(FXWindow *owner,const FXException &ex); 00038 void show(FXWindow *owner,const FXExtendedException &ex); 00039 00040 /// generic extended/enhanced exception 00041 class FXAPI FXExtendedException : public FXErrorException { 00042 private: 00043 static const FXchar exceptionName[]; 00044 FXint code; 00045 public: 00046 FXExtendedException(FXint e=0):FXErrorException(FXExtendedException::exceptionName),code(e){} 00047 FXExtendedException(const FXchar* msg,FXint e=0):FXErrorException(msg),code(e){} 00048 FXint error() const { return code; } 00049 }; 00050 00051 /// generic thread exception 00052 class FXAPI FXThreadException : public FXExtendedException { 00053 private: 00054 static const FXchar exceptionName[]; 00055 public: 00056 FXThreadException(FXint e=0):FXExtendedException(FXThreadException::exceptionName,e){} 00057 FXThreadException(const FXchar *msg,FXint e=0):FXExtendedException(msg,e){} 00058 }; 00059 00060 /// FXThreadFatal : thrown in the event of a fatal error 00061 class FXAPI FXThreadFatal : public FXThreadException { 00062 private: 00063 static const FXchar exceptionName[]; 00064 public: 00065 FXThreadFatal(FXint e=0) : FXThreadException(FXThreadFatal::exceptionName,e){} 00066 FXThreadFatal(const FXchar *msg,FXint e=0) : FXThreadException(msg,e){} 00067 }; 00068 00069 /// FXThreadInvalid : thrown when an operation is invoked with invalid arguments 00070 class FXAPI FXThreadInvalid : public FXThreadException { 00071 private: 00072 static const FXchar exceptionName[]; 00073 public: 00074 FXThreadInvalid() : FXThreadException(FXThreadInvalid::exceptionName,0){} 00075 }; 00076 00077 /// Exception thrown by FXDatabase... interface 00078 class FXDatabaseException : public FXExtendedException { 00079 private: 00080 static const FXchar exceptionName[]; 00081 public: 00082 FXDatabaseException(FXint e=0):FXExtendedException(FXDatabaseException::exceptionName,e){} 00083 FXDatabaseException(const FXchar *msg,FXint e=0):FXExtendedException(msg,e){} 00084 }; 00085 00086 } // namespace FXEX 00087 #endif // FXEXTENDEDEXCEPTION_H