00001 /* 00002 /-------------------------------------------------------------------- 00003 | 00004 | $Id: plexcept.h,v 1.9 2003/11/21 23:35:44 uzadow Exp $ 00005 | 00006 | Copyright (c) 1996-2002 Ulrich von Zadow 00007 | 00008 \-------------------------------------------------------------------- 00009 */ 00010 00011 #ifndef INCL_PLEXCEPT 00012 #define INCL_PLEXCEPT 00013 00014 #ifndef AFX_PLOBJECT_H__E40881E3_C809_11D3_97BC_0050046F615E__INCLUDED_ 00015 #include "plobject.h" 00016 #endif 00017 00018 00019 // Error codes 00020 #define PL_ERROK 0 // No error 00021 #define PL_ERRWRONG_SIGNATURE 1 // Expected file signature 00022 // not found. 00023 #define PL_ERRFORMAT_UNKNOWN 2 // Sanity check failed. 00024 00025 #define PL_ERRPATH_NOT_FOUND 3 // <-- 00026 #define PL_ERRFILE_NOT_FOUND 4 // <-- Problems with the file 00027 #define PL_ERRACCESS_DENIED 5 // <-- system. 00028 00029 #define PL_ERRFORMAT_NOT_SUPPORTED 6 // Known but unsupported 00030 // format. 00031 #define PL_ERRINTERNAL 7 // Internal error of some sort. 00032 #define PL_ERRUNKNOWN_FILE_TYPE 8 // Couldn't recognize the 00033 // file type. 00034 #define PL_ERRDIB_TOO_LARGE 9 // Maximum size for 1 bmp was 00035 // exceeded. 00036 #define PL_ERRNO_MEMORY 10 // Out of memory. 00037 #define PL_ERREND_OF_FILE 11 // End of file reached before 00038 // end of image. 00039 #define PL_ERRFORMAT_NOT_COMPILED 12 // Support for this file format 00040 // was #ifdef'ed out. 00041 #define PL_ERRURL_SOURCE 13 // Curl returned error. 00042 #define PL_ERRBAD_EXIF 14 // 00043 #define PL_ERRDFB 15 // Directfb operation failed. 00044 00045 00046 //! An object of this class is thrown by other classes when an error 00047 //! occurs. It contains an error code and a string describing the 00048 //! error. The error code is meant to be used internally in the 00049 //! program; the descriptive string can be output to the user. Error 00050 //! codes and strings do not correspond 1:1. The strings are more 00051 //! precise. 00052 class PLTextException : public PLObject 00053 { 00054 00055 public: 00056 //! Creates an exception. 00057 PLTextException 00058 ( int Code, 00059 const char * pszErr 00060 ); 00061 00062 //! Creates an exception. 00063 PLTextException 00064 ( int Code, 00065 int MinorCode, 00066 const char * pszErr 00067 ); 00068 00069 //! Copy constructor. 00070 PLTextException 00071 ( const PLTextException& ex 00072 ); 00073 00074 //! Destroys an exception 00075 virtual ~PLTextException 00076 (); 00077 00078 //! Returns the code of the error that caused the exception. Valid 00079 //! error codes are: 00080 //! 00081 //! PL_ERRWRONG_SIGNATURE (1): Expected file signature not found. 00082 //! 00083 //! PL_ERRFORMAT_UNKNOWN (2): Unexpected data encountered. This 00084 //! probably indicates a corrupt file or an unknown file 00085 //! sub-format. 00086 //! 00087 //! PL_ERRPATH_NOT_FOUND (3), PL_ERRFILE_NOT_FOUND (4), 00088 //! PL_ERRACCESS_DENIED (5): Problems with the file system. 00089 //! 00090 //! PL_ERRFORMAT_NOT_SUPPORTED (6): Known but unsupported format. 00091 //! 00092 //! PL_ERRINTERNAL (7): Kaputt. Tell me about it. 00093 //! 00094 //! PL_ERRUNKNOWN_FILE_TYPE (8): Couldn't recognize the file type. 00095 //! 00096 //! PL_ERRDIB_TOO_LARGE (9): Maximum size for 1 bmp was exceeded. 00097 //! (See MAX_BITMAP_SIZE above for an explanation). 00098 //! 00099 //! PL_ERRNO_MEMORY (10): Out of memory. 00100 //! 00101 //! PL_ERREND_OF_FILE (11): End of file reached before end of image. 00102 //! 00103 //! PL_ERRFORMAT_NOT_COMPILED (12): Support for this file format 00104 //! was #ifdef'ed out. 00105 //! 00106 //! PL_ERRURL_SOURCE (13): Curl returned error. 00107 //! 00108 //! PL_ERRBAD_EXIF (14): Error decoding EXIF data. 00109 //! PL_ERRDFB (15): Directfb operation failed. 00110 virtual int GetCode 00111 () 00112 const; 00113 00114 //! In case of PL_ERRURL_SOURCE, the actual curl error code (from curl.h) is 00115 //! placed here. 00116 int GetMinorCode 00117 () 00118 const; 00119 00120 //! This operator allows the exception to be treated as a string 00121 //! whenever needed. The string contains the error message. 00122 virtual operator const char * 00123 () 00124 const; 00125 00126 private: 00127 int m_Code; 00128 int m_MinorCode; 00129 char * m_pszErr; 00130 }; 00131 00132 #endif 00133 /* 00134 /-------------------------------------------------------------------- 00135 | 00136 | $Log: plexcept.h,v $ 00137 | Revision 1.9 2003/11/21 23:35:44 uzadow 00138 | Removed files built by the autotools. 00139 | 00140 | Revision 1.8 2003/08/03 12:03:20 uzadow 00141 | Added unicode support; fixed some header includes. 00142 | 00143 | Revision 1.7 2003/04/20 12:44:47 uzadow 00144 | Added EXIF documentation. 00145 | 00146 | Revision 1.6 2003/04/13 20:13:21 uzadow 00147 | Added counted pointer classes (windows ver.) 00148 | 00149 | Revision 1.5 2003/02/15 21:26:58 uzadow 00150 | Added win32 version of url data source. 00151 | 00152 | Revision 1.4 2002/11/18 14:44:46 uzadow 00153 | Added PNG compression support, fixed docs. 00154 | 00155 | Revision 1.3 2002/08/07 18:50:38 uzadow 00156 | More cygwin compatibility changes. 00157 | 00158 | Revision 1.2 2002/03/03 16:29:55 uzadow 00159 | Re-added BPPWanted. 00160 | 00161 | Revision 1.1 2001/09/16 19:03:22 uzadow 00162 | Added global name prefix PL, changed most filenames. 00163 | 00164 | Revision 1.4 2000/01/17 23:38:07 Ulrich von Zadow 00165 | MFC removal aftermath. 00166 | 00167 | 00168 \-------------------------------------------------------------------- 00169 */