- Main Page
- Related Pages
- Classes
- Files

# SAXException.hpp

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 /*
    00019  * $Id: SAXException.hpp 527149 2007-04-10 14:56:39Z amassari $
    00020  */
    00021
    00022 #if !defined(XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP)
    00023 #define XERCESC_INCLUDE_GUARD_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 SAX_EXPORT 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);//delete [] fMsg;
    00113     }
    00114
    00116
    00117
    00125     SAXException& operator=(const SAXException& toCopy)
    00126     {
    00127         if (this == &toCopy)
    00128             return *this;
    00129
    00130         fMemoryManager->deallocate(fMsg);//delete [] 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     //  Protected data members
    00153     //
    00154     //  fMsg
    00155     //      This is the text of the error that is being thrown.
    00156     // -----------------------------------------------------------------------
    00157     XMLCh*  fMsg;
    00158     MemoryManager* fMemoryManager;
    00159 };
    00160
    00161 class SAX_EXPORT 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 SAX_EXPORT 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