SAXException.hpp
Go to the documentation of this file.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id$
*/
#if !defined(XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP)
#define XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/util/XMemory.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class SAX_EXPORT SAXException : public XMemory
{
public:
SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager))
, fMemoryManager(manager)
{
}
SAXException(const XMLCh* const msg,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
fMsg(XMLString::replicate(msg, manager))
, fMemoryManager(manager)
{
}
SAXException(const char* const msg,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
fMsg(XMLString::transcode(msg, manager))
, fMemoryManager(manager)
{
}
SAXException(const SAXException& toCopy) :
XMemory(toCopy)
, fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager))
, fMemoryManager(toCopy.fMemoryManager)
{
}
virtual ~SAXException()
{
fMemoryManager->deallocate(fMsg);//delete [] fMsg;
}
SAXException& operator=(const SAXException& toCopy)
{
if (this == &toCopy)
return *this;
fMemoryManager->deallocate(fMsg);//delete [] fMsg;
fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager);
fMemoryManager = toCopy.fMemoryManager;
return *this;
}
virtual const XMLCh* getMessage() const
{
return fMsg;
}
protected :
// -----------------------------------------------------------------------
// Protected data members
//
// fMsg
// This is the text of the error that is being thrown.
// -----------------------------------------------------------------------
XMLCh* fMsg;
MemoryManager* fMemoryManager;
};
class SAX_EXPORT SAXNotSupportedException : public SAXException
{
public:
SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
SAXNotSupportedException(const XMLCh* const msg,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
SAXNotSupportedException(const char* const msg,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
SAXNotSupportedException(const SAXException& toCopy);
};
class SAX_EXPORT SAXNotRecognizedException : public SAXException
{
public:
SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
SAXNotRecognizedException(const XMLCh* const msg,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
SAXNotRecognizedException(const char* const msg,
MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
SAXNotRecognizedException(const SAXException& toCopy);
};
XERCES_CPP_NAMESPACE_END
#endif
XMLString.hpp
XMLUni.hpp
XMemory.hpp
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
SAX_EXPORT
#define SAX_EXPORT
Definition XercesDefs.hpp:164
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
XMLCh
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
MemoryManager
Configurable memory manager.
Definition MemoryManager.hpp:40
SAXException
Encapsulate a general SAX error or warning.
Definition SAXException.hpp:52
SAXException::SAXException
SAXException(const XMLCh *const msg, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a new SAXException.
Definition SAXException.hpp:74
SAXException::~SAXException
virtual ~SAXException()
Destructor.
Definition SAXException.hpp:110
SAXException::fMemoryManager
MemoryManager * fMemoryManager
Definition SAXException.hpp:158
SAXException::SAXException
SAXException(const char *const msg, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a new SAXException.
Definition SAXException.hpp:89
SAXException::operator=
SAXException & operator=(const SAXException &toCopy)
Assignment operator.
Definition SAXException.hpp:125
SAXException::getMessage
virtual const XMLCh * getMessage() const
Get the contents of the message.
Definition SAXException.hpp:143
SAXException::fMsg
XMLCh * fMsg
Definition SAXException.hpp:157
SAXException::SAXException
SAXException(const SAXException &toCopy)
Copy constructor.
Definition SAXException.hpp:102
SAXException::SAXException
SAXException(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Default constructor.
Definition SAXException.hpp:60
SAXNotRecognizedException
Definition SAXException.hpp:196
SAXNotRecognizedException::SAXNotRecognizedException
SAXNotRecognizedException(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
SAXNotRecognizedException::SAXNotRecognizedException
SAXNotRecognizedException(const SAXException &toCopy)
Copy constructor.
SAXNotRecognizedException::SAXNotRecognizedException
SAXNotRecognizedException(const char *const msg, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a new SAXException.
SAXNotRecognizedException::SAXNotRecognizedException
SAXNotRecognizedException(const XMLCh *const msg, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a new SAXException.
SAXNotSupportedException
Definition SAXException.hpp:162
SAXNotSupportedException::SAXNotSupportedException
SAXNotSupportedException(const char *const msg, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a new SAXException.
SAXNotSupportedException::SAXNotSupportedException
SAXNotSupportedException(const SAXException &toCopy)
Copy constructor.
SAXNotSupportedException::SAXNotSupportedException
SAXNotSupportedException(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
SAXNotSupportedException::SAXNotSupportedException
SAXNotSupportedException(const XMLCh *const msg, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Create a new SAXException.
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition PlatformUtils.hpp:121
XMLString
Class for representing native character strings and handling common string operations.
Definition XMLString.hpp:46
XMLString::replicate
static char * replicate(const char *const toRep, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Replicates a string NOTE: The returned buffer is allocated with the MemoryManager.
XMLUni
Definition XMLUni.hpp:45
XMemory
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition XMemory.hpp:41