Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:14:21

0001 // This may look like C code, but it is really -*- C++ -*-
0002 //
0003 // Copyright Bob Friesenhahn, 1999, 2000, 2001, 2002, 2003
0004 //
0005 // Copyright @ 2014 ImageMagick Studio LLC, a non-profit organization
0006 // dedicated to making software imaging solutions freely available.
0007 //
0008 // Definition of Magick::Exception and derived classes
0009 // Magick::Warning* and Magick::Error*.  Derived from C++ STD
0010 // 'exception' class for convenience.
0011 //
0012 // These classes form part of the Magick++ user interface.
0013 //
0014 
0015 #if !defined(Magick_Exception_header)
0016 #define Magick_Exception_header
0017 
0018 #include "Magick++/Include.h"
0019 #include <string>
0020 #include <exception>
0021 
0022 namespace Magick
0023 {
0024   class MagickPPExport Exception: public std::exception
0025   {
0026   public:
0027 
0028     // Construct with message string
0029     Exception(const std::string& what_);
0030 
0031     // Construct with message string and nested exception
0032     Exception(const std::string& what_, Exception* nested_);
0033 
0034     // Copy constructor
0035     Exception(const Exception& original_);
0036 
0037     // Destructor
0038     virtual ~Exception() throw();
0039 
0040     // Assignment operator
0041     Exception& operator=(const Exception& original_);
0042 
0043     // Get string identifying exception
0044     virtual const char* what() const throw();
0045 
0046     // Get nested exception
0047     const Exception* nested() const throw();
0048 
0049     //////////////////////////////////////////////////////////////////////
0050     //
0051     // No user-serviceable parts beyond this point
0052     //
0053     //////////////////////////////////////////////////////////////////////
0054 
0055     void nested(Exception* nested_) throw();
0056 
0057   private:
0058     std::string _what;
0059     Exception* _nested;
0060   };
0061 
0062   //
0063   // Error exceptions
0064   //
0065 
0066   class MagickPPExport Error: public Exception
0067   {
0068   public:
0069     explicit Error(const std::string& what_);
0070     explicit Error(const std::string& what_,Exception *nested_);
0071     ~Error() throw();
0072   };
0073 
0074   class MagickPPExport ErrorBlob: public Error
0075   {
0076   public:
0077     explicit ErrorBlob(const std::string& what_);
0078     explicit ErrorBlob(const std::string& what_,Exception *nested_);
0079     ~ErrorBlob() throw();
0080   };
0081 
0082   class MagickPPExport ErrorCache: public Error
0083   {
0084   public:
0085     explicit ErrorCache(const std::string& what_);
0086     explicit ErrorCache(const std::string& what_,Exception *nested_);
0087     ~ErrorCache() throw();
0088   };
0089 
0090   class MagickPPExport ErrorCoder: public Error
0091   {
0092   public:
0093     explicit ErrorCoder(const std::string& what_);
0094     explicit ErrorCoder(const std::string& what_,Exception *nested_);
0095     ~ErrorCoder() throw();
0096   };
0097 
0098   class MagickPPExport ErrorConfigure: public Error
0099   {
0100   public:
0101     explicit ErrorConfigure(const std::string& what_);
0102     explicit ErrorConfigure(const std::string& what_,Exception *nested_);
0103     ~ErrorConfigure() throw();
0104   };
0105 
0106   class MagickPPExport ErrorCorruptImage: public Error
0107   {
0108   public:
0109     explicit ErrorCorruptImage(const std::string& what_);
0110     explicit ErrorCorruptImage(const std::string& what_,Exception *nested_);
0111     ~ErrorCorruptImage() throw();
0112   };
0113 
0114   class MagickPPExport ErrorDelegate: public Error
0115   {
0116   public:
0117     explicit ErrorDelegate(const std::string& what_);
0118     explicit ErrorDelegate(const std::string& what_,Exception *nested_);
0119     ~ErrorDelegate() throw();
0120   };
0121 
0122   class MagickPPExport ErrorDraw: public Error
0123   {
0124   public:
0125     explicit ErrorDraw(const std::string& what_);
0126     explicit ErrorDraw(const std::string& what_,Exception *nested_);
0127     ~ErrorDraw() throw();
0128   };
0129 
0130   class MagickPPExport ErrorFileOpen: public Error
0131   {
0132   public:
0133     explicit ErrorFileOpen(const std::string& what_);
0134     explicit ErrorFileOpen(const std::string& what_,Exception *nested_);
0135     ~ErrorFileOpen() throw();
0136   };
0137 
0138   class MagickPPExport ErrorImage: public Error
0139   {
0140   public:
0141     explicit ErrorImage(const std::string& what_);
0142     explicit ErrorImage(const std::string& what_,Exception *nested_);
0143     ~ErrorImage() throw();
0144   };
0145 
0146   class MagickPPExport ErrorMissingDelegate: public Error
0147   {
0148   public:
0149     explicit ErrorMissingDelegate(const std::string& what_);
0150     explicit ErrorMissingDelegate(const std::string& what_,Exception *nested_);
0151     ~ErrorMissingDelegate() throw();
0152   };
0153 
0154   class MagickPPExport ErrorModule: public Error
0155   {
0156   public:
0157     explicit ErrorModule(const std::string& what_);
0158     explicit ErrorModule(const std::string& what_,Exception *nested_);
0159     ~ErrorModule() throw();
0160   };
0161 
0162   class MagickPPExport ErrorMonitor: public Error
0163   {
0164   public:
0165     explicit ErrorMonitor(const std::string& what_);
0166     explicit ErrorMonitor(const std::string& what_,Exception *nested_);
0167     ~ErrorMonitor() throw();
0168   };
0169 
0170   class MagickPPExport ErrorOption: public Error
0171   {
0172   public:
0173     explicit ErrorOption(const std::string& what_);
0174     explicit ErrorOption(const std::string& what_,Exception *nested_);
0175     ~ErrorOption() throw();
0176   };
0177 
0178   class MagickPPExport ErrorPolicy: public Error
0179   {
0180   public:
0181     explicit ErrorPolicy(const std::string& what_);
0182     explicit ErrorPolicy(const std::string& what_,Exception *nested_);
0183     ~ErrorPolicy() throw();
0184   };
0185 
0186   class MagickPPExport ErrorRegistry: public Error
0187   {
0188   public:
0189     explicit ErrorRegistry(const std::string& what_);
0190     explicit ErrorRegistry(const std::string& what_,Exception *nested_);
0191     ~ErrorRegistry() throw();
0192   };
0193 
0194   class MagickPPExport ErrorResourceLimit: public Error
0195   {
0196   public:
0197     explicit ErrorResourceLimit(const std::string& what_);
0198     explicit ErrorResourceLimit(const std::string& what_,Exception *nested_);
0199     ~ErrorResourceLimit() throw();
0200   };
0201 
0202   class MagickPPExport ErrorStream: public Error
0203   {
0204   public:
0205     explicit ErrorStream(const std::string& what_);
0206     explicit ErrorStream(const std::string& what_,Exception *nested_);
0207     ~ErrorStream() throw();
0208   };
0209 
0210   class MagickPPExport ErrorType: public Error
0211   {
0212   public:
0213     explicit ErrorType(const std::string& what_);
0214     explicit ErrorType(const std::string& what_,Exception *nested_);
0215     ~ErrorType() throw();
0216   };
0217 
0218   class MagickPPExport ErrorUndefined: public Error
0219   {
0220   public:
0221     explicit ErrorUndefined(const std::string& what_);
0222     explicit ErrorUndefined(const std::string& what_,Exception *nested_);
0223     ~ErrorUndefined() throw();
0224   };
0225 
0226   class MagickPPExport ErrorXServer: public Error
0227   {
0228   public:
0229     explicit ErrorXServer(const std::string& what_);
0230     explicit ErrorXServer(const std::string& what_,Exception *nested_);
0231     ~ErrorXServer() throw();
0232   };
0233 
0234   //
0235   // Warnings
0236   //
0237 
0238   class MagickPPExport Warning: public Exception
0239   {
0240   public:
0241     explicit Warning(const std::string& what_);
0242     explicit Warning(const std::string& what_,Exception *nested_);
0243     ~Warning() throw();
0244   };
0245 
0246   class MagickPPExport WarningBlob: public Warning
0247   {
0248   public:
0249     explicit WarningBlob(const std::string& what_);
0250     explicit WarningBlob(const std::string& what_,Exception *nested_);
0251     ~WarningBlob() throw();
0252   };
0253 
0254   class MagickPPExport WarningCache: public Warning
0255   {
0256   public:
0257     explicit WarningCache(const std::string& what_);
0258     explicit WarningCache(const std::string& what_,Exception *nested_);
0259     ~WarningCache() throw();
0260   };
0261 
0262   class MagickPPExport WarningCoder: public Warning
0263   {
0264   public:
0265     explicit WarningCoder(const std::string& what_);
0266     explicit WarningCoder(const std::string& what_,Exception *nested_);
0267     ~WarningCoder() throw();
0268   };
0269 
0270   class MagickPPExport WarningConfigure: public Warning
0271   {
0272   public:
0273     explicit WarningConfigure(const std::string& what_);
0274     explicit WarningConfigure(const std::string& what_,Exception *nested_);
0275     ~WarningConfigure() throw();
0276   };
0277 
0278   class MagickPPExport WarningCorruptImage: public Warning
0279   {
0280   public:
0281     explicit WarningCorruptImage(const std::string& what_);
0282     explicit WarningCorruptImage(const std::string& what_,Exception *nested_);
0283     ~WarningCorruptImage() throw();
0284   };
0285 
0286   class MagickPPExport WarningDelegate: public Warning
0287   {
0288   public:
0289     explicit WarningDelegate(const std::string& what_);
0290     explicit WarningDelegate(const std::string& what_,Exception *nested_);
0291     ~WarningDelegate() throw();
0292   };
0293 
0294   class MagickPPExport WarningDraw : public Warning
0295   {
0296   public:
0297     explicit WarningDraw(const std::string& what_);
0298     explicit WarningDraw(const std::string& what_,Exception *nested_);
0299     ~WarningDraw() throw();
0300   };
0301 
0302   class MagickPPExport WarningFileOpen: public Warning
0303   {
0304   public:
0305     explicit WarningFileOpen(const std::string& what_);
0306     explicit WarningFileOpen(const std::string& what_,Exception *nested_);
0307     ~WarningFileOpen() throw();
0308   };
0309 
0310   class MagickPPExport WarningImage: public Warning
0311   {
0312   public:
0313     explicit WarningImage(const std::string& what_);
0314     explicit WarningImage(const std::string& what_,Exception *nested_);
0315     ~WarningImage() throw();
0316   };
0317 
0318   class MagickPPExport WarningMissingDelegate: public Warning
0319   {
0320   public:
0321     explicit WarningMissingDelegate(const std::string& what_);
0322     explicit WarningMissingDelegate(const std::string& what_,
0323       Exception *nested_);
0324     ~WarningMissingDelegate() throw();
0325   };
0326 
0327   class MagickPPExport WarningModule: public Warning
0328   {
0329   public:
0330     explicit WarningModule(const std::string& what_);
0331     explicit WarningModule(const std::string& what_,Exception *nested_);
0332     ~WarningModule() throw();
0333   };
0334 
0335   class MagickPPExport WarningMonitor: public Warning
0336   {
0337   public:
0338     explicit WarningMonitor(const std::string& what_);
0339     explicit WarningMonitor(const std::string& what_,Exception *nested_);
0340     ~WarningMonitor() throw();
0341   };
0342 
0343   class MagickPPExport WarningOption: public Warning
0344   {
0345   public:
0346     explicit WarningOption(const std::string& what_);
0347     explicit WarningOption(const std::string& what_,Exception *nested_);
0348     ~WarningOption() throw();
0349   };
0350 
0351   class MagickPPExport WarningPolicy: public Warning
0352   {
0353   public:
0354     explicit WarningPolicy(const std::string& what_);
0355     explicit WarningPolicy(const std::string& what_,Exception *nested_);
0356     ~WarningPolicy() throw();
0357   };
0358 
0359   class MagickPPExport WarningRegistry: public Warning
0360   {
0361   public:
0362     explicit WarningRegistry(const std::string& what_);
0363     explicit WarningRegistry(const std::string& what_,Exception *nested_);
0364     ~WarningRegistry() throw();
0365   };
0366 
0367   class MagickPPExport WarningResourceLimit: public Warning
0368   {
0369   public:
0370     explicit WarningResourceLimit(const std::string& what_);
0371     explicit WarningResourceLimit(const std::string& what_,Exception *nested_);
0372     ~WarningResourceLimit() throw();
0373   };
0374 
0375   class MagickPPExport WarningStream: public Warning
0376   {
0377   public:
0378     explicit WarningStream(const std::string& what_);
0379     explicit WarningStream(const std::string& what_,Exception *nested_);
0380     ~WarningStream() throw();
0381   };
0382 
0383   class MagickPPExport WarningType: public Warning
0384   {
0385   public:
0386     explicit WarningType(const std::string& what_);
0387     explicit WarningType(const std::string& what_,Exception *nested_);
0388     ~WarningType() throw();
0389   };
0390 
0391   class MagickPPExport WarningUndefined: public Warning
0392   {
0393   public:
0394     explicit WarningUndefined(const std::string& what_);
0395     explicit WarningUndefined(const std::string& what_,Exception *nested_);
0396     ~WarningUndefined() throw();
0397   };
0398 
0399   class MagickPPExport WarningXServer: public Warning
0400   {
0401   public:
0402     explicit WarningXServer(const std::string& what_);
0403     explicit WarningXServer(const std::string& what_,Exception *nested_);
0404     ~WarningXServer() throw();
0405   };
0406 
0407   //
0408   // No user-serviceable components beyond this point.
0409   //
0410 
0411   std::string formatExceptionMessage(
0412     const MagickCore::ExceptionInfo *exception_);
0413 
0414   Exception* createException(const MagickCore::ExceptionInfo *exception_);
0415 
0416   // Throw exception based on raw data
0417   extern MagickPPExport void throwExceptionExplicit(
0418     const MagickCore::ExceptionType severity_,const char* reason_,
0419     const char* description_=(char *) NULL);
0420 
0421   // Thow exception based on ImageMagick's ExceptionInfo
0422   extern MagickPPExport void throwException(
0423     MagickCore::ExceptionInfo *exception_,const bool quiet_=false);
0424 
0425 } // namespace Magick
0426 
0427 #endif // Magick_Exception_header