 |
Exiv2
|
Go to the documentation of this file.
32 #include "exiv2lib_export.h"
85 enum Level { debug = 0, info = 1, warn = 2, error = 3, mute = 4 };
92 typedef void (*Handler)(int,
const char*);
105 std::ostringstream& os();
115 static void setLevel(
Level level);
121 static void setHandler(Handler handler);
123 static Level level();
125 static Handler handler();
127 static void defaultHandler(
int level,
const char* s);
134 static Handler handler_;
136 const Level msgType_;
138 std::ostringstream os_;
144 #define EXV_DEBUG if (LogMsg::debug >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::debug).os()
145 #define EXV_INFO if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::info).os()
147 #define EXV_WARNING if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::warn).os()
149 #define EXV_ERROR if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) LogMsg(LogMsg::error).os()
155 # pragma warning( disable : 4275 )
159 template<
typename charT,
typename T>
162 std::basic_ostringstream<charT> os;
181 virtual int code()
const throw() =0;
187 return os << error.what();
192 kerGeneralError = -1,
202 kerDataSourceOpenFailed,
204 kerFileContainsUnknownImageType,
205 kerMemoryContainsUnknownImageType,
206 kerUnsupportedImageType,
207 kerFailedToReadImageData,
209 kerFailedToMapFileForReadWrite,
212 kerMemoryTransferFailed,
213 kerInputDataReadFailed,
215 kerNoImageInInputData,
222 kerUnsupportedDataAreaOffsetType,
224 kerUnsupportedDateFormat,
225 kerUnsupportedTimeFormat,
226 kerWritingImageFormatUnsupported,
227 kerInvalidSettingForImage,
229 kerFunctionNotSupported,
230 kerNoNamespaceInfoForXmpPrefix,
231 kerNoPrefixForNamespace,
232 kerTooLargeJpegSegment,
233 kerUnhandledXmpdatum,
236 kerDecodeLangAltPropertyFailed,
237 kerDecodeLangAltQualifierFailed,
238 kerEncodeLangAltPropertyFailed,
239 kerPropertyNameIdentificationFailed,
240 kerSchemaNamespaceNotRegistered,
241 kerNoNamespaceForPrefix,
242 kerAliasesNotSupported,
244 kerTooManyTiffDirectoryEntries,
245 kerMultipleTiffArrayElementTagsInDirectory,
246 kerWrongTiffArrayElementTagType,
247 kerInvalidKeyXmpValue,
248 kerInvalidIccProfile,
250 kerTiffDirectoryTooLarge,
252 kerInvalidLangAltValue,
254 kerCorruptedMetadata,
255 kerArithmeticOverflow,
263 template<
typename charT>
276 template<
typename A,
typename B>
280 template<
typename A,
typename B,
typename C>
289 virtual inline int code()
const throw();
294 virtual inline const char* what()
const throw();
295 #ifdef EXV_UNICODE_PATH
300 virtual inline const wchar_t* wwhat()
const throw();
314 std::basic_string<charT> arg1_;
315 std::basic_string<charT> arg2_;
316 std::basic_string<charT> arg3_;
318 #ifdef EXV_UNICODE_PATH
325 #ifdef EXV_UNICODE_PATH
334 const char*
errMsg(
int code);
336 template<
typename charT>
338 : code_(code), count_(0)
343 template<
typename charT>
template<
typename A>
350 template<
typename charT>
template<
typename A,
typename B>
352 : code_(code), count_(2),
359 template<
typename charT>
template<
typename A,
typename B,
typename C>
361 : code_(code), count_(3),
369 template<
typename charT>
374 template<
typename charT>
380 template<
typename charT>
386 #ifdef EXV_UNICODE_PATH
387 template<
typename charT>
390 return wmsg_.c_str();
395 # pragma warning( default : 4275 )
399 #endif // #ifndef ERROR_HPP_
const char * errMsg(int code)
Return the error message for the error with code code.
Definition: error.cpp:298
virtual int code() const
Return the error code.
Definition: error.hpp:375
std::ostringstream & os()
Return a reference to the ostringstream which holds the log message.
Definition: error.cpp:191
static void setLevel(Level level)
Set the log level. Only log messages with a level greater or equal level are sent to the log message ...
Definition: error.cpp:193
Error class interface. Allows the definition and use of a hierarchy of error classes which can all be...
Definition: error.hpp:174
@ kerValueTooLarge
Entry::setValue: Value too large.
Definition: error.hpp:218
Level
Defined log levels. To suppress all log messages, either set the log level to mute or set the log mes...
Definition: error.hpp:85
static Level level()
Return the current log level.
Definition: error.cpp:197
static void setHandler(Handler handler)
Set the log message handler. The default handler writes log messages to standard error....
Definition: error.cpp:195
const T * find(T(&src)[N], const K &key)
Find an element that matches key in the array src.
Definition: types.hpp:497
EXIV2API std::ostream & operator<<(std::ostream &os, const DataSet &dataSet)
Output operator for dataSet.
Definition: datasets.cpp:709
~LogMsg()
Destructor, passes the log message to the message handler depending on the log level.
Definition: error.cpp:185
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
static void defaultHandler(int level, const char *s)
The default log handler. Sends the log message to standard error.
Definition: error.cpp:201
bool operator==(const TagDetails &td, const LensTypeAndFocalLengthAndMaxAperture <fl)
Compare tag details with a lens entry.
Definition: canonmn_int.cpp:2820
virtual ~BasicError()
Virtual destructor. (Needed because of throw())
Definition: error.hpp:370
static Handler handler()
Return the current log message handler.
Definition: error.cpp:199
Simple error class used for exceptions. An output operator is provided to print errors to a stream.
Definition: error.hpp:264
void(* Handler)(int, const char *)
Type for a log message handler function. The function receives the log level and message and can proc...
Definition: error.hpp:92
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:324
@ kerDataAreaValueTooLarge
Entry::setDataArea: Value too large.
Definition: error.hpp:220
virtual const char * what() const
Return the error message as a C-string. The pointer returned by what() is valid only as long as the B...
Definition: error.hpp:381
Class for a log message, used by the library. Applications can set the log level and provide a custom...
Definition: error.hpp:75
std::string toString(const T &arg)
Utility function to convert the argument of any type to a string.
Definition: types.hpp:510
ErrorCode
Complete list of all Exiv2 error codes.
Definition: error.hpp:191
std::basic_string< charT > toBasicString(const T &arg)
Generalised toString function.
Definition: error.hpp:160
BasicError(ErrorCode code)
Constructor taking only an error code.
Definition: error.hpp:337
Error class for exceptions, log message class.