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 
67  {
68  public:
69  explicit Error(const std::string& what_);
70  explicit Error(const std::string& what_,Exception *nested_);
71  ~Error() throw();
72  };
73 
75  {
76  public:
77  explicit ErrorBlob(const std::string& what_);
78  explicit ErrorBlob(const std::string& what_,Exception *nested_);
79  ~ErrorBlob() throw();
80  };
81 
83  {
84  public:
85  explicit ErrorCache(const std::string& what_);
86  explicit ErrorCache(const std::string& what_,Exception *nested_);
87  ~ErrorCache() throw();
88  };
89 
91  {
92  public:
93  explicit ErrorCoder(const std::string& what_);
94  explicit ErrorCoder(const std::string& what_,Exception *nested_);
95  ~ErrorCoder() throw();
96  };
97 
99  {
100  public:
101  explicit ErrorConfigure(const std::string& what_);
102  explicit ErrorConfigure(const std::string& what_,Exception *nested_);
103  ~ErrorConfigure() throw();
104  };
105 
107  {
108  public:
109  explicit ErrorCorruptImage(const std::string& what_);
110  explicit ErrorCorruptImage(const std::string& what_,Exception *nested_);
111  ~ErrorCorruptImage() throw();
112  };
113 
115  {
116  public:
117  explicit ErrorDelegate(const std::string& what_);
118  explicit ErrorDelegate(const std::string& what_,Exception *nested_);
119  ~ErrorDelegate() throw();
120  };
121 
123  {
124  public:
125  explicit ErrorDraw(const std::string& what_);
126  explicit ErrorDraw(const std::string& what_,Exception *nested_);
127  ~ErrorDraw() throw();
128  };
129 
131  {
132  public:
133  explicit ErrorFileOpen(const std::string& what_);
134  explicit ErrorFileOpen(const std::string& what_,Exception *nested_);
135  ~ErrorFileOpen() throw();
136  };
137 
139  {
140  public:
141  explicit ErrorImage(const std::string& what_);
142  explicit ErrorImage(const std::string& what_,Exception *nested_);
143  ~ErrorImage() throw();
144  };
145 
147  {
148  public:
149  explicit ErrorMissingDelegate(const std::string& what_);
150  explicit ErrorMissingDelegate(const std::string& what_,Exception *nested_);
151  ~ErrorMissingDelegate() throw();
152  };
153 
155  {
156  public:
157  explicit ErrorModule(const std::string& what_);
158  explicit ErrorModule(const std::string& what_,Exception *nested_);
159  ~ErrorModule() throw();
160  };
161 
163  {
164  public:
165  explicit ErrorMonitor(const std::string& what_);
166  explicit ErrorMonitor(const std::string& what_,Exception *nested_);
167  ~ErrorMonitor() throw();
168  };
169 
171  {
172  public:
173  explicit ErrorOption(const std::string& what_);
174  explicit ErrorOption(const std::string& what_,Exception *nested_);
175  ~ErrorOption() throw();
176  };
177 
179  {
180  public:
181  explicit ErrorPolicy(const std::string& what_);
182  explicit ErrorPolicy(const std::string& what_,Exception *nested_);
183  ~ErrorPolicy() throw();
184  };
185 
187  {
188  public:
189  explicit ErrorRegistry(const std::string& what_);
190  explicit ErrorRegistry(const std::string& what_,Exception *nested_);
191  ~ErrorRegistry() throw();
192  };
193 
195  {
196  public:
197  explicit ErrorResourceLimit(const std::string& what_);
198  explicit ErrorResourceLimit(const std::string& what_,Exception *nested_);
199  ~ErrorResourceLimit() throw();
200  };
201 
203  {
204  public:
205  explicit ErrorStream(const std::string& what_);
206  explicit ErrorStream(const std::string& what_,Exception *nested_);
207  ~ErrorStream() throw();
208  };
209 
211  {
212  public:
213  explicit ErrorType(const std::string& what_);
214  explicit ErrorType(const std::string& what_,Exception *nested_);
215  ~ErrorType() throw();
216  };
217 
219  {
220  public:
221  explicit ErrorUndefined(const std::string& what_);
222  explicit ErrorUndefined(const std::string& what_,Exception *nested_);
223  ~ErrorUndefined() throw();
224  };
225 
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 
239  {
240  public:
241  explicit Warning(const std::string& what_);
242  explicit Warning(const std::string& what_,Exception *nested_);
243  ~Warning() throw();
244  };
245 
247  {
248  public:
249  explicit WarningBlob(const std::string& what_);
250  explicit WarningBlob(const std::string& what_,Exception *nested_);
251  ~WarningBlob() throw();
252  };
253 
255  {
256  public:
257  explicit WarningCache(const std::string& what_);
258  explicit WarningCache(const std::string& what_,Exception *nested_);
259  ~WarningCache() throw();
260  };
261 
263  {
264  public:
265  explicit WarningCoder(const std::string& what_);
266  explicit WarningCoder(const std::string& what_,Exception *nested_);
267  ~WarningCoder() throw();
268  };
269 
271  {
272  public:
273  explicit WarningConfigure(const std::string& what_);
274  explicit WarningConfigure(const std::string& what_,Exception *nested_);
275  ~WarningConfigure() throw();
276  };
277 
279  {
280  public:
281  explicit WarningCorruptImage(const std::string& what_);
282  explicit WarningCorruptImage(const std::string& what_,Exception *nested_);
283  ~WarningCorruptImage() throw();
284  };
285 
287  {
288  public:
289  explicit WarningDelegate(const std::string& what_);
290  explicit WarningDelegate(const std::string& what_,Exception *nested_);
291  ~WarningDelegate() throw();
292  };
293 
295  {
296  public:
297  explicit WarningDraw(const std::string& what_);
298  explicit WarningDraw(const std::string& what_,Exception *nested_);
299  ~WarningDraw() throw();
300  };
301 
303  {
304  public:
305  explicit WarningFileOpen(const std::string& what_);
306  explicit WarningFileOpen(const std::string& what_,Exception *nested_);
307  ~WarningFileOpen() throw();
308  };
309 
311  {
312  public:
313  explicit WarningImage(const std::string& what_);
314  explicit WarningImage(const std::string& what_,Exception *nested_);
315  ~WarningImage() throw();
316  };
317 
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 
328  {
329  public:
330  explicit WarningModule(const std::string& what_);
331  explicit WarningModule(const std::string& what_,Exception *nested_);
332  ~WarningModule() throw();
333  };
334 
336  {
337  public:
338  explicit WarningMonitor(const std::string& what_);
339  explicit WarningMonitor(const std::string& what_,Exception *nested_);
340  ~WarningMonitor() throw();
341  };
342 
344  {
345  public:
346  explicit WarningOption(const std::string& what_);
347  explicit WarningOption(const std::string& what_,Exception *nested_);
348  ~WarningOption() throw();
349  };
350 
352  {
353  public:
354  explicit WarningPolicy(const std::string& what_);
355  explicit WarningPolicy(const std::string& what_,Exception *nested_);
356  ~WarningPolicy() throw();
357  };
358 
360  {
361  public:
362  explicit WarningRegistry(const std::string& what_);
363  explicit WarningRegistry(const std::string& what_,Exception *nested_);
364  ~WarningRegistry() throw();
365  };
366 
368  {
369  public:
370  explicit WarningResourceLimit(const std::string& what_);
371  explicit WarningResourceLimit(const std::string& what_,Exception *nested_);
372  ~WarningResourceLimit() throw();
373  };
374 
376  {
377  public:
378  explicit WarningStream(const std::string& what_);
379  explicit WarningStream(const std::string& what_,Exception *nested_);
380  ~WarningStream() throw();
381  };
382 
384  {
385  public:
386  explicit WarningType(const std::string& what_);
387  explicit WarningType(const std::string& what_,Exception *nested_);
388  ~WarningType() throw();
389  };
390 
392  {
393  public:
394  explicit WarningUndefined(const std::string& what_);
395  explicit WarningUndefined(const std::string& what_,Exception *nested_);
396  ~WarningUndefined() throw();
397  };
398 
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
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
std::string formatExceptionMessage(const MagickCore::ExceptionInfo *exception_)
Definition: Exception.cpp:687
MagickPPExport void throwException(MagickCore::ExceptionInfo *exception_, const bool quiet_=false)
#define MagickPPExport
Definition: Include.h:297
MagickPPExport void throwExceptionExplicit(const MagickCore::ExceptionType severity_, const char *reason_, const char *description_=(char *) NULL)
Definition: Exception.cpp:808
Definition: Blob.h:17
Exception * createException(const MagickCore::ExceptionInfo *exception_)
Definition: Exception.cpp:702