DocumentationOverviewBuilding ASL Documentation Library Wiki Docs Indices Browse Perforce More InfoRelease NotesWiki Site Search License Success Stories Contributors MediaDownloadPerforce Depots SupportASL SourceForge HomeMailing Lists Discussion Forums Report Bugs Suggest Features Contribute to ASL RSSShort-text newsFull-text news File releases Other Adobe ProjectsAdobe AirAdobe GIL Adobe Labs Adobe Media Gallery Adobe XMP Tamarin project (Mozilla Foundation) Other ResourcesBoostRIAForge SGI STL |
dng_exceptions.hGo to the documentation of this file.00001 /*****************************************************************************/ 00002 // Copyright 2006-2007 Adobe Systems Incorporated 00003 // All Rights Reserved. 00004 // 00005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 00006 // accordance with the terms of the Adobe license agreement accompanying it. 00007 /*****************************************************************************/ 00008 00009 /* $Id: //mondo/workarea/stern/camera_raw/dng_sdk/source/dng_exceptions.h#11 $ */ 00010 /* $DateTime: 2008/04/25 11:10:55 $ */ 00011 /* $Change: 449391 $ */ 00012 /* $Author: stern $ */ 00013 00018 /*****************************************************************************/ 00019 00020 #ifndef __dng_exceptions__ 00021 #define __dng_exceptions__ 00022 00023 /*****************************************************************************/ 00024 00025 #include "dng_errors.h" 00026 #include "dng_flags.h" 00027 00028 /*****************************************************************************/ 00029 00031 00032 void ReportWarning (const char *message, 00033 const char *sub_message = NULL); 00034 00035 /*****************************************************************************/ 00036 00038 00039 void ReportError (const char *message, 00040 const char *sub_message = NULL); 00041 00042 /*****************************************************************************/ 00043 00045 00046 class dng_exception 00047 { 00048 00049 private: 00050 00051 dng_error_code fErrorCode; 00052 00053 public: 00054 00057 00058 dng_exception (dng_error_code code) 00059 00060 : fErrorCode (code) 00061 00062 { 00063 } 00064 00065 virtual ~dng_exception () 00066 { 00067 } 00068 00071 00072 dng_error_code ErrorCode () const 00073 { 00074 return fErrorCode; 00075 } 00076 00077 }; 00078 00079 /******************************************************************************/ 00080 00082 00083 void Throw_dng_error (dng_error_code err, 00084 const char * message = NULL, 00085 const char * sub_message = NULL, 00086 bool silent = false); 00087 00088 /******************************************************************************/ 00089 00092 00093 inline void Fail_dng_error (dng_error_code err) 00094 { 00095 00096 if (err != dng_error_none) 00097 { 00098 00099 Throw_dng_error (err); 00100 00101 } 00102 00103 } 00104 00105 /*****************************************************************************/ 00106 00109 00110 inline void ThrowProgramError (const char * sub_message = NULL) 00111 { 00112 00113 Throw_dng_error (dng_error_unknown, NULL, sub_message); 00114 00115 } 00116 00117 /*****************************************************************************/ 00118 00121 00122 inline void ThrowNotYetImplemented (const char * sub_message = NULL) 00123 { 00124 00125 Throw_dng_error (dng_error_not_yet_implemented, NULL, sub_message); 00126 00127 } 00128 00129 /*****************************************************************************/ 00130 00133 00134 inline void ThrowSilentError () 00135 { 00136 00137 Throw_dng_error (dng_error_silent); 00138 00139 } 00140 00141 /*****************************************************************************/ 00142 00145 00146 inline void ThrowUserCanceled () 00147 { 00148 00149 Throw_dng_error (dng_error_user_canceled); 00150 00151 } 00152 00153 /*****************************************************************************/ 00154 00157 00158 inline void ThrowHostInsufficient (const char * sub_message = NULL) 00159 { 00160 00161 Throw_dng_error (dng_error_host_insufficient, NULL, sub_message); 00162 00163 } 00164 00165 /*****************************************************************************/ 00166 00169 00170 inline void ThrowMemoryFull (const char * sub_message = NULL) 00171 { 00172 00173 Throw_dng_error (dng_error_memory, NULL, sub_message); 00174 00175 } 00176 00177 /*****************************************************************************/ 00178 00181 00182 inline void ThrowBadFormat (const char * sub_message = NULL) 00183 { 00184 00185 Throw_dng_error (dng_error_bad_format, NULL, sub_message); 00186 00187 } 00188 00189 /*****************************************************************************/ 00190 00193 00194 inline void ThrowMatrixMath (const char * sub_message = NULL) 00195 { 00196 00197 Throw_dng_error (dng_error_matrix_math, NULL, sub_message); 00198 00199 } 00200 00201 /*****************************************************************************/ 00202 00205 00206 inline void ThrowOpenFile (const char * sub_message = NULL, bool silent = false) 00207 { 00208 00209 Throw_dng_error (dng_error_open_file, NULL, sub_message, silent); 00210 00211 } 00212 00213 /*****************************************************************************/ 00214 00217 00218 inline void ThrowReadFile (const char *sub_message = NULL) 00219 { 00220 00221 Throw_dng_error (dng_error_read_file, NULL, sub_message); 00222 00223 } 00224 00225 /*****************************************************************************/ 00226 00229 00230 inline void ThrowWriteFile (const char *sub_message = NULL) 00231 { 00232 00233 Throw_dng_error (dng_error_write_file, NULL, sub_message); 00234 00235 } 00236 00237 /*****************************************************************************/ 00238 00241 00242 inline void ThrowEndOfFile (const char *sub_message = NULL) 00243 { 00244 00245 Throw_dng_error (dng_error_end_of_file, NULL, sub_message); 00246 00247 } 00248 00249 /*****************************************************************************/ 00250 00253 00254 inline void ThrowFileIsDamaged () 00255 { 00256 00257 Throw_dng_error (dng_error_file_is_damaged); 00258 00259 } 00260 00261 /*****************************************************************************/ 00262 00265 00266 inline void ThrowImageTooBigDNG () 00267 { 00268 00269 Throw_dng_error (dng_error_image_too_big_dng); 00270 00271 } 00272 00273 /*****************************************************************************/ 00274 00277 00278 inline void ThrowImageTooBigTIFF () 00279 { 00280 00281 Throw_dng_error (dng_error_image_too_big_tiff); 00282 00283 } 00284 00285 /*****************************************************************************/ 00286 00287 #endif 00288 00289 /*****************************************************************************/ |