Magick++: Exception.h Source File

Magick++ 7.1.0

Exception.h
Go to the documentation of this file.
1 // This may look like C code, but it is really -*- C++ -*-
2 //
3 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
4 //
5 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
6 // dedicated to making software imaging solutions freely available.
7 //
8 // Definition of Magick::Exception and derived classes
9 // Magick::Warning* and Magick::Error*. Derived from C++ STD
10 // 'exception' class for convenience.
11 //
12 // These classes form part of the Magick++ user interface.
13 //
14
15 #if !defined(Magick_Exception_header)
16 #define Magick_Exception_header
17
18 #include "Magick++/Include.h"
19 #include <string>
20 #include <exception>
21
22 namespace Magick
23 {
24 class MagickPPExport Exception: public std::exception
25 {
26 public:
27
28 // Construct with message string
29 Exception(const std::string& what_);
30
31 // Construct with message string and nested exception
32 Exception(const std::string& what_, Exception* nested_);
33
34 // Copy constructor
35 Exception(const Exception& original_);
36
37 // Destructor
38 virtual ~Exception() throw();
39
40 // Assignment operator
41 Exception& operator=(const Exception& original_);
42
43 // Get string identifying exception
44 virtual const char* what() const throw();
45
46 // Get nested exception
47 const Exception* nested() const throw();
48
50 //
51 // No user-serviceable parts beyond this point
52 //
54
55 void nested(Exception* nested_) throw();
56
57 private:
58 std::string _what;
59 Exception* _nested;
60 };
61
62 //
63 // Error exceptions
64 //
65
66 class MagickPPExport Error: public Exception
67 {
68 public:
69 explicit Error(const std::string& what_);
70 explicit Error(const std::string& what_,Exception *nested_);
71 ~Error() throw();
72 };
73
74 class MagickPPExport ErrorBlob: public Error
75 {
76 public:
77 explicit ErrorBlob(const std::string& what_);
78 explicit ErrorBlob(const std::string& what_,Exception *nested_);
79 ~ErrorBlob() throw();
80 };
81
82 class MagickPPExport ErrorCache: public Error
83 {
84 public:
85 explicit ErrorCache(const std::string& what_);
86 explicit ErrorCache(const std::string& what_,Exception *nested_);
87 ~ErrorCache() throw();
88 };
89
90 class MagickPPExport ErrorCoder: public Error
91 {
92 public:
93 explicit ErrorCoder(const std::string& what_);
94 explicit ErrorCoder(const std::string& what_,Exception *nested_);
95 ~ErrorCoder() throw();
96 };
97
98 class MagickPPExport ErrorConfigure: public Error
99 {
100 public:
101 explicit ErrorConfigure(const std::string& what_);
102 explicit ErrorConfigure(const std::string& what_,Exception *nested_);
103 ~ErrorConfigure() throw();
104 };
105
106 class MagickPPExport ErrorCorruptImage: public Error
107 {
108 public:
109 explicit ErrorCorruptImage(const std::string& what_);
110 explicit ErrorCorruptImage(const std::string& what_,Exception *nested_);
111 ~ErrorCorruptImage() throw();
112 };
113
114 class MagickPPExport ErrorDelegate: public Error
115 {
116 public:
117 explicit ErrorDelegate(const std::string& what_);
118 explicit ErrorDelegate(const std::string& what_,Exception *nested_);
119 ~ErrorDelegate() throw();
120 };
121
122 class MagickPPExport ErrorDraw: public Error
123 {
124 public:
125 explicit ErrorDraw(const std::string& what_);
126 explicit ErrorDraw(const std::string& what_,Exception *nested_);
127 ~ErrorDraw() throw();
128 };
129
130 class MagickPPExport ErrorFileOpen: public Error
131 {
132 public:
133 explicit ErrorFileOpen(const std::string& what_);
134 explicit ErrorFileOpen(const std::string& what_,Exception *nested_);
135 ~ErrorFileOpen() throw();
136 };
137
138 class MagickPPExport ErrorImage: public Error
139 {
140 public:
141 explicit ErrorImage(const std::string& what_);
142 explicit ErrorImage(const std::string& what_,Exception *nested_);
143 ~ErrorImage() throw();
144 };
145
146 class MagickPPExport ErrorMissingDelegate: public Error
147 {
148 public:
149 explicit ErrorMissingDelegate(const std::string& what_);
150 explicit ErrorMissingDelegate(const std::string& what_,Exception *nested_);
151 ~ErrorMissingDelegate() throw();
152 };
153
154 class MagickPPExport ErrorModule: public Error
155 {
156 public:
157 explicit ErrorModule(const std::string& what_);
158 explicit ErrorModule(const std::string& what_,Exception *nested_);
159 ~ErrorModule() throw();
160 };
161
162 class MagickPPExport ErrorMonitor: public Error
163 {
164 public:
165 explicit ErrorMonitor(const std::string& what_);
166 explicit ErrorMonitor(const std::string& what_,Exception *nested_);
167 ~ErrorMonitor() throw();
168 };
169
170 class MagickPPExport ErrorOption: public Error
171 {
172 public:
173 explicit ErrorOption(const std::string& what_);
174 explicit ErrorOption(const std::string& what_,Exception *nested_);
175 ~ErrorOption() throw();
176 };
177
178 class MagickPPExport ErrorPolicy: public Error
179 {
180 public:
181 explicit ErrorPolicy(const std::string& what_);
182 explicit ErrorPolicy(const std::string& what_,Exception *nested_);
183 ~ErrorPolicy() throw();
184 };
185
186 class MagickPPExport ErrorRegistry: public Error
187 {
188 public:
189 explicit ErrorRegistry(const std::string& what_);
190 explicit ErrorRegistry(const std::string& what_,Exception *nested_);
191 ~ErrorRegistry() throw();
192 };
193
194 class MagickPPExport ErrorResourceLimit: public Error
195 {
196 public:
197 explicit ErrorResourceLimit(const std::string& what_);
198 explicit ErrorResourceLimit(const std::string& what_,Exception *nested_);
199 ~ErrorResourceLimit() throw();
200 };
201
202 class MagickPPExport ErrorStream: public Error
203 {
204 public:
205 explicit ErrorStream(const std::string& what_);
206 explicit ErrorStream(const std::string& what_,Exception *nested_);
207 ~ErrorStream() throw();
208 };
209
210 class MagickPPExport ErrorType: public Error
211 {
212 public:
213 explicit ErrorType(const std::string& what_);
214 explicit ErrorType(const std::string& what_,Exception *nested_);
215 ~ErrorType() throw();
216 };
217
218 class MagickPPExport ErrorUndefined: public Error
219 {
220 public:
221 explicit ErrorUndefined(const std::string& what_);
222 explicit ErrorUndefined(const std::string& what_,Exception *nested_);
223 ~ErrorUndefined() throw();
224 };
225
226 class MagickPPExport ErrorXServer: public Error
227 {
228 public:
229 explicit ErrorXServer(const std::string& what_);
230 explicit ErrorXServer(const std::string& what_,Exception *nested_);
231 ~ErrorXServer() throw();
232 };
233
234 //
235 // Warnings
236 //
237
238 class MagickPPExport Warning: public Exception
239 {
240 public:
241 explicit Warning(const std::string& what_);
242 explicit Warning(const std::string& what_,Exception *nested_);
243 ~Warning() throw();
244 };
245
246 class MagickPPExport WarningBlob: public Warning
247 {
248 public:
249 explicit WarningBlob(const std::string& what_);
250 explicit WarningBlob(const std::string& what_,Exception *nested_);
251 ~WarningBlob() throw();
252 };
253
254 class MagickPPExport WarningCache: public Warning
255 {
256 public:
257 explicit WarningCache(const std::string& what_);
258 explicit WarningCache(const std::string& what_,Exception *nested_);
259 ~WarningCache() throw();
260 };
261
262 class MagickPPExport WarningCoder: public Warning
263 {
264 public:
265 explicit WarningCoder(const std::string& what_);
266 explicit WarningCoder(const std::string& what_,Exception *nested_);
267 ~WarningCoder() throw();
268 };
269
270 class MagickPPExport WarningConfigure: public Warning
271 {
272 public:
273 explicit WarningConfigure(const std::string& what_);
274 explicit WarningConfigure(const std::string& what_,Exception *nested_);
275 ~WarningConfigure() throw();
276 };
277
278 class MagickPPExport WarningCorruptImage: public Warning
279 {
280 public:
281 explicit WarningCorruptImage(const std::string& what_);
282 explicit WarningCorruptImage(const std::string& what_,Exception *nested_);
283 ~WarningCorruptImage() throw();
284 };
285
286 class MagickPPExport WarningDelegate: public Warning
287 {
288 public:
289 explicit WarningDelegate(const std::string& what_);
290 explicit WarningDelegate(const std::string& what_,Exception *nested_);
291 ~WarningDelegate() throw();
292 };
293
294 class MagickPPExport WarningDraw : public Warning
295 {
296 public:
297 explicit WarningDraw(const std::string& what_);
298 explicit WarningDraw(const std::string& what_,Exception *nested_);
299 ~WarningDraw() throw();
300 };
301
302 class MagickPPExport WarningFileOpen: public Warning
303 {
304 public:
305 explicit WarningFileOpen(const std::string& what_);
306 explicit WarningFileOpen(const std::string& what_,Exception *nested_);
307 ~WarningFileOpen() throw();
308 };
309
310 class MagickPPExport WarningImage: public Warning
311 {
312 public:
313 explicit WarningImage(const std::string& what_);
314 explicit WarningImage(const std::string& what_,Exception *nested_);
315 ~WarningImage() throw();
316 };
317
318 class MagickPPExport WarningMissingDelegate: public Warning
319 {
320 public:
321 explicit WarningMissingDelegate(const std::string& what_);
322 explicit WarningMissingDelegate(const std::string& what_,
323 Exception *nested_);
324 ~WarningMissingDelegate() throw();
325 };
326
327 class MagickPPExport WarningModule: public Warning
328 {
329 public:
330 explicit WarningModule(const std::string& what_);
331 explicit WarningModule(const std::string& what_,Exception *nested_);
332 ~WarningModule() throw();
333 };
334
335 class MagickPPExport WarningMonitor: public Warning
336 {
337 public:
338 explicit WarningMonitor(const std::string& what_);
339 explicit WarningMonitor(const std::string& what_,Exception *nested_);
340 ~WarningMonitor() throw();
341 };
342
343 class MagickPPExport WarningOption: public Warning
344 {
345 public:
346 explicit WarningOption(const std::string& what_);
347 explicit WarningOption(const std::string& what_,Exception *nested_);
348 ~WarningOption() throw();
349 };
350
351 class MagickPPExport WarningPolicy: public Warning
352 {
353 public:
354 explicit WarningPolicy(const std::string& what_);
355 explicit WarningPolicy(const std::string& what_,Exception *nested_);
356 ~WarningPolicy() throw();
357 };
358
359 class MagickPPExport WarningRegistry: public Warning
360 {
361 public:
362 explicit WarningRegistry(const std::string& what_);
363 explicit WarningRegistry(const std::string& what_,Exception *nested_);
364 ~WarningRegistry() throw();
365 };
366
367 class MagickPPExport WarningResourceLimit: public Warning
368 {
369 public:
370 explicit WarningResourceLimit(const std::string& what_);
371 explicit WarningResourceLimit(const std::string& what_,Exception *nested_);
372 ~WarningResourceLimit() throw();
373 };
374
375 class MagickPPExport WarningStream: public Warning
376 {
377 public:
378 explicit WarningStream(const std::string& what_);
379 explicit WarningStream(const std::string& what_,Exception *nested_);
380 ~WarningStream() throw();
381 };
382
383 class MagickPPExport WarningType: public Warning
384 {
385 public:
386 explicit WarningType(const std::string& what_);
387 explicit WarningType(const std::string& what_,Exception *nested_);
388 ~WarningType() throw();
389 };
390
391 class MagickPPExport WarningUndefined: public Warning
392 {
393 public:
394 explicit WarningUndefined(const std::string& what_);
395 explicit WarningUndefined(const std::string& what_,Exception *nested_);
396 ~WarningUndefined() throw();
397 };
398
399 class MagickPPExport WarningXServer: public Warning
400 {
401 public:
402 explicit WarningXServer(const std::string& what_);
403 explicit WarningXServer(const std::string& what_,Exception *nested_);
404 ~WarningXServer() throw();
405 };
406
407 //
408 // No user-serviceable components beyond this point.
409 //
410
411 std::string formatExceptionMessage(
412 const MagickCore::ExceptionInfo *exception_);
413
414 Exception* createException(const MagickCore::ExceptionInfo *exception_);
415
416 // Throw exception based on raw data
417 extern MagickPPExport void throwExceptionExplicit(
418 const MagickCore::ExceptionType severity_,const char* reason_,
419 const char* description_=(char *) NULL);
420
421 // Thow exception based on ImageMagick's ExceptionInfo
422 extern MagickPPExport void throwException(
423 MagickCore::ExceptionInfo *exception_,const bool quiet_=false);
424
425 } // namespace Magick
426
427 #endif // Magick_Exception_header
Magick::WarningFileOpen
Definition: Exception.h:302
Magick::WarningCoder
Definition: Exception.h:262
Magick::ErrorImage
Definition: Exception.h:138
Magick::WarningRegistry
Definition: Exception.h:359
Magick::WarningMissingDelegate
Definition: Exception.h:318
Magick::ErrorDraw
Definition: Exception.h:122
Magick::WarningXServer
Definition: Exception.h:399
Magick::Error
Definition: Exception.h:66
Magick::ErrorDelegate
Definition: Exception.h:114
Magick::ErrorMonitor
Definition: Exception.h:162
Magick::ErrorFileOpen
Definition: Exception.h:130
Magick::ErrorOption
Definition: Exception.h:170
Magick::ErrorConfigure
Definition: Exception.h:98
Magick::WarningUndefined
Definition: Exception.h:391
Magick::WarningMonitor
Definition: Exception.h:335
Magick::WarningPolicy
Definition: Exception.h:351
Magick::formatExceptionMessage
std::string formatExceptionMessage(const MagickCore::ExceptionInfo *exception_)
Definition: Exception.cpp:687
Magick::throwException
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
Magick::ErrorBlob
Definition: Exception.h:74
Magick::WarningOption
Definition: Exception.h:343
Magick::WarningBlob
Definition: Exception.h:246
Magick::ErrorResourceLimit
Definition: Exception.h:194
Magick::ErrorRegistry
Definition: Exception.h:186
Magick::ErrorCorruptImage
Definition: Exception.h:106
Magick::ErrorXServer
Definition: Exception.h:226
MagickPPExport
#define MagickPPExport
Definition: Include.h:297
Magick::Warning
Definition: Exception.h:238
Magick::Exception
Definition: Exception.h:24
Magick::WarningCache
Definition: Exception.h:254
Magick::ErrorModule
Definition: Exception.h:154
Magick::WarningCorruptImage
Definition: Exception.h:278
Magick::throwExceptionExplicit
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:808
Magick::WarningResourceLimit
Definition: Exception.h:367
Magick::ErrorPolicy
Definition: Exception.h:178
Magick::WarningType
Definition: Exception.h:383
Magick::ErrorCoder
Definition: Exception.h:90
Include.h
Magick::ErrorMissingDelegate
Definition: Exception.h:146
Magick::WarningImage
Definition: Exception.h:310
Magick::WarningDelegate
Definition: Exception.h:286
Magick::ErrorType
Definition: Exception.h:210
Magick
Definition: Blob.h:17
Magick::WarningConfigure
Definition: Exception.h:270
Magick::WarningModule
Definition: Exception.h:327
Magick::ErrorStream
Definition: Exception.h:202
Magick::ErrorUndefined
Definition: Exception.h:218
Magick::createException
Exception * createException(const MagickCore::ExceptionInfo *exception_)
Definition: Exception.cpp:702
Magick::ErrorCache
Definition: Exception.h:82
Magick::WarningDraw
Definition: Exception.h:294
Magick::WarningStream
Definition: Exception.h:375