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