Xerces-C++: SAXException.hpp Source File

Xerces-C++ 3.3.0

SAXException.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id$
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP)
23#define XERCESC_INCLUDE_GUARD_SAXEXCEPTION_HPP
24
25#include <xercesc/util/XMLString.hpp>
26#include <xercesc/util/XMLUni.hpp>
27#include <xercesc/util/XMemory.hpp>
28
29 XERCES_CPP_NAMESPACE_BEGIN
30
31
51 class SAX_EXPORT SAXException : public XMemory
52{
53public:
60 SAXException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
61
62 fMsg(XMLString::replicate(XMLUni::fgZeroLenString, manager))
63 , fMemoryManager(manager)
64 {
65 }
66
74 SAXException(const XMLCh* const msg,
75 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
76
77 fMsg(XMLString::replicate(msg, manager))
78 , fMemoryManager(manager)
79 {
80 }
81
89 SAXException(const char* const msg,
90 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) :
91
92 fMsg(XMLString::transcode(msg, manager))
93 , fMemoryManager(manager)
94 {
95 }
96
102 SAXException(const SAXException& toCopy) :
103 XMemory(toCopy)
104 , fMsg(XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager))
105 , fMemoryManager(toCopy.fMemoryManager)
106 {
107 }
108
110 virtual ~SAXException()
111 {
112 fMemoryManager->deallocate(fMsg);//delete [] fMsg;
113 }
114
116
117
125 SAXException& operator=(const SAXException& toCopy)
126 {
127 if (this == &toCopy)
128 return *this;
129
130 fMemoryManager->deallocate(fMsg);//delete [] fMsg;
131 fMsg = XMLString::replicate(toCopy.fMsg, toCopy.fMemoryManager);
132 fMemoryManager = toCopy.fMemoryManager;
133 return *this;
134 }
136
143 virtual const XMLCh* getMessage() const
144 {
145 return fMsg;
146 }
148
149
150protected :
151 // -----------------------------------------------------------------------
152 // Protected data members
153 //
154 // fMsg
155 // This is the text of the error that is being thrown.
156 // -----------------------------------------------------------------------
157 XMLCh* fMsg;
158 MemoryManager* fMemoryManager;
159};
160
161 class SAX_EXPORT SAXNotSupportedException : public SAXException
162{
163
164public:
165 SAXNotSupportedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
166
174 SAXNotSupportedException(const XMLCh* const msg,
175 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
176
184 SAXNotSupportedException(const char* const msg,
185 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
186
192 SAXNotSupportedException(const SAXException& toCopy);
193};
194
195 class SAX_EXPORT SAXNotRecognizedException : public SAXException
196{
197public:
198 SAXNotRecognizedException(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
199
207 SAXNotRecognizedException(const XMLCh* const msg,
208 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
209
217 SAXNotRecognizedException(const char* const msg,
218 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
219
225 SAXNotRecognizedException(const SAXException& toCopy);
226};
227
228 XERCES_CPP_NAMESPACE_END
229
230#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