15#include "exiv2lib_export.h"
79 using Handler = void (*)(int,
const char*);
93 std::ostringstream& os();
102 static void setLevel(
Level level);
108 static void setHandler(
Handler handler);
110 static Level level();
114 static void defaultHandler(
int level,
const char* s);
125 std::ostringstream os_;
132 if (LogMsg::debug >= LogMsg::level() && LogMsg::handler()) \
133 LogMsg(LogMsg::debug).os()
136 if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) \
137 LogMsg(LogMsg::info).os()
140 if (LogMsg::warn >= LogMsg::level() && LogMsg::handler()) \
141 LogMsg(LogMsg::warn).os()
144 if (LogMsg::error >= LogMsg::level() && LogMsg::handler()) \
145 LogMsg(LogMsg::error).os()
150#pragma warning(disable : 4275)
154template <
typename charT,
typename T>
156 std::basic_ostringstream<charT> os;
173 kerDataSourceOpenFailed,
175 kerFileContainsUnknownImageType,
176 kerMemoryContainsUnknownImageType,
177 kerUnsupportedImageType,
178 kerFailedToReadImageData,
180 kerFailedToMapFileForReadWrite,
183 kerMemoryTransferFailed,
184 kerInputDataReadFailed,
186 kerNoImageInInputData,
189 kerDataAreaValueTooLarge,
191 kerUnsupportedDataAreaOffsetType,
193 kerUnsupportedDateFormat,
194 kerUnsupportedTimeFormat,
195 kerWritingImageFormatUnsupported,
196 kerInvalidSettingForImage,
198 kerFunctionNotSupported,
199 kerNoNamespaceInfoForXmpPrefix,
200 kerNoPrefixForNamespace,
201 kerTooLargeJpegSegment,
202 kerUnhandledXmpdatum,
205 kerDecodeLangAltPropertyFailed,
206 kerDecodeLangAltQualifierFailed,
207 kerEncodeLangAltPropertyFailed,
208 kerPropertyNameIdentificationFailed,
209 kerSchemaNamespaceNotRegistered,
210 kerNoNamespaceForPrefix,
211 kerAliasesNotSupported,
213 kerTooManyTiffDirectoryEntries,
214 kerMultipleTiffArrayElementTagsInDirectory,
215 kerWrongTiffArrayElementTagType,
216 kerInvalidKeyXmpValue,
217 kerInvalidIccProfile,
219 kerTiffDirectoryTooLarge,
221 kerInvalidLangAltValue,
223 kerCorruptedMetadata,
224 kerArithmeticOverflow,
226 kerInvalidIconvEncoding,
227 kerFileAccessDisabled,
236class EXIV2API
Error :
public std::exception {
244 template <
typename A>
250 template <
typename A,
typename B>
257 template <
typename A,
typename B,
typename C>
272 [[nodiscard]]
ErrorCode code() const noexcept;
277 [[nodiscard]] const
char* what() const noexcept override;
284 void setMsg(
int count);
296inline std::ostream& operator<<(std::ostream& os, const
Error& error) {
297 return os << error.what();
301#pragma warning(default : 4275)
Simple error class used for exceptions. An output operator is provided to print errors to a stream.
Definition: error.hpp:236
~Error() noexcept override=default
Virtual destructor. (Needed because of throw())
Error(ErrorCode code, const A &arg1)
Constructor taking an error code and one argument.
Definition: error.hpp:245
Error(ErrorCode code, const A &arg1, const B &arg2, const C &arg3)
Constructor taking an error code and three arguments.
Definition: error.hpp:258
Error(ErrorCode code, const A &arg1, const B &arg2)
Constructor taking an error code and two arguments.
Definition: error.hpp:251
Class for a log message, used by the library. Applications can set the log level and provide a custom...
Definition: error.hpp:56
void(*)(int, const char *) Handler
Type for a log message handler function. The function receives the log level and message and can proc...
Definition: error.hpp:79
LogMsg(const LogMsg &)=delete
Prevent copy-construction: not implemented.
LogMsg & operator=(const LogMsg &)=delete
Prevent assignment: not implemented.
Level
Defined log levels. To suppress all log messages, either set the log level to mute or set the log mes...
Definition: error.hpp:66
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition: asfvideo.hpp:15
ErrorCode
Complete list of all Exiv2 error codes.
Definition: error.hpp:162
std::basic_string< charT > toBasicString(const T &arg)
Generalised toString function.
Definition: error.hpp:155