00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef SAXEXCEPTION_HPP
00023 #define SAXEXCEPTION_HPP
00024 
00025 #include <xercesc/util/XMLString.hpp>
00026 #include <xercesc/util/XMLUni.hpp>
00027 #include <xercesc/util/XMemory.hpp>
00028 
00029 XERCES_CPP_NAMESPACE_BEGIN
00030 
00031 
00051 class  SAXException : public XMemory
00052 {
00053 public:
00060     SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
00061 
00062         fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager))
00063         , fMemoryManager(manager)
00064     {
00065     }
00066 
00074     SAXException(const XMLCh* const msg,
00075                  MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
00076 
00077         fMsg(XMLString::replicate(msg, manager))
00078         , fMemoryManager(manager)
00079     {
00080     }
00081 
00089     SAXException(const char* const msg,
00090                  MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
00091 
00092         fMsg(XMLString::transcode(msg, manager))
00093         , fMemoryManager(manager)
00094     {
00095     }
00096 
00102     SAXException(const SAXException& toCopy) :
00103         XMemory(toCopy)
00104         , fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager))
00105         , fMemoryManager(toCopy.fMemoryManager)
00106     {
00107     }
00108 
00110     virtual ~SAXException()
00111     {
00112         fMemoryManager->deallocate(fMsg);
00113     }
00114 
00116 
00117 
00125     SAXException& operator=(const SAXException& toCopy)
00126     {
00127         if (this == &toCopy)
00128             return *this;
00129 
00130         fMemoryManager->deallocate(fMsg);
00131         fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager);
00132         fMemoryManager = toCopy.fMemoryManager;
00133         return *this;
00134     }
00136 
00143     virtual const XMLCh* getMessage() const
00144     {
00145         return fMsg;
00146     }
00148 
00149 
00150 protected :
00151     
00152     
00153     
00154     
00155     
00156     
00157     XMLCh*  fMsg;
00158     MemoryManager* fMemoryManager;
00159 };
00160 
00161 class  SAXNotSupportedException : public SAXException
00162 {
00163 
00164 public:
00165     SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00166 
00174     SAXNotSupportedException(const XMLCh* const msg,
00175                              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00176 
00184     SAXNotSupportedException(const char* const msg,
00185                              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00186 
00192     SAXNotSupportedException(const SAXException& toCopy);
00193 };
00194 
00195 class  SAXNotRecognizedException : public SAXException
00196 {
00197 public:
00198     SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00199 
00207     SAXNotRecognizedException(const XMLCh* const msg,
00208                               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00209 
00217     SAXNotRecognizedException(const char* const msg,
00218                               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
00219 
00225     SAXNotRecognizedException(const SAXException& toCopy);
00226 };
00227 
00228 XERCES_CPP_NAMESPACE_END
00229 
00230 #endif