Xerces-C++: XMLNotationDecl.hpp Source File

Xerces-C++ 3.2.4

XMLNotationDecl.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_XMLNOTATIONDECL_HPP)
23#define XERCESC_INCLUDE_GUARD_XMLNOTATIONDECL_HPP
24
25#include <xercesc/util/XMemory.hpp>
26#include <xercesc/util/PlatformUtils.hpp>
27#include <xercesc/util/XMLString.hpp>
28#include <xercesc/internal/XSerializable.hpp>
29
30 XERCES_CPP_NAMESPACE_BEGIN
31
41 class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
42{
43public:
44 // -----------------------------------------------------------------------
45 // Constructors and Destructor
46 // -----------------------------------------------------------------------
47
50 XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
51 XMLNotationDecl
52 (
53 const XMLCh* const notName
54 , const XMLCh* const pubId
55 , const XMLCh* const sysId
56 , const XMLCh* const baseURI = 0
57 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
58 );
60
63 ~XMLNotationDecl();
65
66
67 // -----------------------------------------------------------------------
68 // Getter methods
69 // -----------------------------------------------------------------------
70 XMLSize_t getId() const;
71 const XMLCh* getName() const;
72 const XMLCh* getPublicId() const;
73 const XMLCh* getSystemId() const;
74 const XMLCh* getBaseURI() const;
75 unsigned int getNameSpaceId() const;
76 MemoryManager* getMemoryManager() const;
77
78
79 // -----------------------------------------------------------------------
80 // Setter methods
81 // -----------------------------------------------------------------------
82 void setId(const XMLSize_t newId);
83 void setName
84 (
85 const XMLCh* const notName
86 );
87 void setPublicId(const XMLCh* const newId);
88 void setSystemId(const XMLCh* const newId);
89 void setBaseURI(const XMLCh* const newId);
90 void setNameSpaceId(const unsigned int newId);
91
92 // -----------------------------------------------------------------------
93 // Support named collection element semantics
94 // -----------------------------------------------------------------------
95 const XMLCh* getKey() const;
96
97 /***
98 * Support for Serialization/De-serialization
99 ***/
100 DECL_XSERIALIZABLE(XMLNotationDecl)
101
102private :
103 // -----------------------------------------------------------------------
104 // Unimplemented constructors and operators
105 // -----------------------------------------------------------------------
106 XMLNotationDecl(const XMLNotationDecl&);
107 XMLNotationDecl& operator=(const XMLNotationDecl&);
108
109
110 // -----------------------------------------------------------------------
111 // XMLNotationDecl: Private helper methods
112 // -----------------------------------------------------------------------
113 void cleanUp();
114
115
116 // -----------------------------------------------------------------------
117 // Private data members
118 //
119 // fId
120 // This is the unique id given to this notation decl.
121 //
122 // fName
123 // The notation's name, which identifies the type of notation it
124 // applies to.
125 //
126 // fPublicId
127 // The text of the notation's public id, if any.
128 //
129 // fSystemId
130 // The text of the notation's system id, if any.
131 //
132 // fBaseURI
133 // The text of the notation's base URI
134 // -----------------------------------------------------------------------
135 XMLSize_t fId;
136 unsigned int fNameSpaceId;
137 XMLCh* fName;
138 XMLCh* fPublicId;
139 XMLCh* fSystemId;
140 XMLCh* fBaseURI;
141 MemoryManager* fMemoryManager;
142};
143
144
145// -----------------------------------------------------------------------
146// Getter methods
147// -----------------------------------------------------------------------
148 inline XMLSize_t XMLNotationDecl::getId() const
149{
150 return fId;
151}
152
153 inline const XMLCh* XMLNotationDecl::getName() const
154{
155 return fName;
156}
157
158 inline unsigned int XMLNotationDecl::getNameSpaceId() const
159{
160 return fNameSpaceId;
161}
162
163 inline const XMLCh* XMLNotationDecl::getPublicId() const
164{
165 return fPublicId;
166}
167
168 inline const XMLCh* XMLNotationDecl::getSystemId() const
169{
170 return fSystemId;
171}
172
173 inline const XMLCh* XMLNotationDecl::getBaseURI() const
174{
175 return fBaseURI;
176}
177
178 inline MemoryManager* XMLNotationDecl::getMemoryManager() const
179{
180 return fMemoryManager;
181}
182
183// -----------------------------------------------------------------------
184// Setter methods
185// -----------------------------------------------------------------------
186 inline void XMLNotationDecl::setId(const XMLSize_t newId)
187{
188 fId = newId;
189}
190
191 inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
192{
193 fNameSpaceId = newId;
194}
195
196 inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
197{
198 if (fPublicId)
199 fMemoryManager->deallocate(fPublicId);
200
201 fPublicId = XMLString::replicate(newId, fMemoryManager);
202}
203
204 inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
205{
206 if (fSystemId)
207 fMemoryManager->deallocate(fSystemId);
208
209 fSystemId = XMLString::replicate(newId, fMemoryManager);
210}
211
212 inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
213{
214 if (fBaseURI)
215 fMemoryManager->deallocate(fBaseURI);
216
217 fBaseURI = XMLString::replicate(newId, fMemoryManager);
218}
219
220
221// ---------------------------------------------------------------------------
222// XMLNotationDecl: Support named pool element semantics
223// ---------------------------------------------------------------------------
224 inline const XMLCh* XMLNotationDecl::getKey() const
225{
226 return fName;
227}
228
229 XERCES_CPP_NAMESPACE_END
230
231#endif
PlatformUtils.hpp
XMLString.hpp
XMemory.hpp
XMLPARSER_EXPORT
#define XMLPARSER_EXPORT
Definition: XercesDefs.hpp:163
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:120
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:112
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:40
MemoryManager::deallocate
virtual void deallocate(void *p)=0
This method deallocates memory.
XMLNotationDecl
This class represents the core information about a notation declaration that all validators must at l...
Definition: XMLNotationDecl.hpp:42
XMLNotationDecl::XMLNotationDecl
XMLNotationDecl(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
XMLNotationDecl::getMemoryManager
MemoryManager * getMemoryManager() const
Definition: XMLNotationDecl.hpp:178
XMLNotationDecl::setPublicId
void setPublicId(const XMLCh *const newId)
Definition: XMLNotationDecl.hpp:196
XMLNotationDecl::XMLNotationDecl
XMLNotationDecl(const XMLCh *const notName, const XMLCh *const pubId, const XMLCh *const sysId, const XMLCh *const baseURI=0, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
XMLNotationDecl::setNameSpaceId
void setNameSpaceId(const unsigned int newId)
Definition: XMLNotationDecl.hpp:191
XMLNotationDecl::getId
XMLSize_t getId() const
Definition: XMLNotationDecl.hpp:148
XMLNotationDecl::getSystemId
const XMLCh * getSystemId() const
Definition: XMLNotationDecl.hpp:168
XMLNotationDecl::getBaseURI
const XMLCh * getBaseURI() const
Definition: XMLNotationDecl.hpp:173
XMLNotationDecl::getName
const XMLCh * getName() const
Definition: XMLNotationDecl.hpp:153
XMLNotationDecl::getNameSpaceId
unsigned int getNameSpaceId() const
Definition: XMLNotationDecl.hpp:158
XMLNotationDecl::setId
void setId(const XMLSize_t newId)
Definition: XMLNotationDecl.hpp:186
XMLNotationDecl::setSystemId
void setSystemId(const XMLCh *const newId)
Definition: XMLNotationDecl.hpp:204
XMLNotationDecl::getKey
const XMLCh * getKey() const
Definition: XMLNotationDecl.hpp:224
XMLNotationDecl::getPublicId
const XMLCh * getPublicId() const
Definition: XMLNotationDecl.hpp:163
XMLNotationDecl::~XMLNotationDecl
~XMLNotationDecl()
XMLNotationDecl::setBaseURI
void setBaseURI(const XMLCh *const newId)
Definition: XMLNotationDecl.hpp:212
XMLNotationDecl::setName
void setName(const XMLCh *const notName)
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
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.
XMemory
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition: XMemory.hpp:41