Xerces-C++ 3.3.0
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
28#include <xercesc/internal/XSerializable.hpp>
29
31
41class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory
42{
43public:
44 // -----------------------------------------------------------------------
45 // Constructors and Destructor
46 // -----------------------------------------------------------------------
47
52 (
53 const XMLCh* const notName
54 , const XMLCh* const pubId
55 , const XMLCh* const sysId
56 , const XMLCh* const baseURI = 0
58 );
60
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);
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 // -----------------------------------------------------------------------
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// -----------------------------------------------------------------------
149{
150 return fId;
151}
152
153inline const XMLCh* XMLNotationDecl::getName() const
154{
155 return fName;
156}
157
158inline unsigned int XMLNotationDecl::getNameSpaceId() const
159{
160 return fNameSpaceId;
161}
162
164{
165 return fPublicId;
166}
167
169{
170 return fSystemId;
171}
172
174{
175 return fBaseURI;
176}
177
179{
180 return fMemoryManager;
181}
182
183// -----------------------------------------------------------------------
184// Setter methods
185// -----------------------------------------------------------------------
186inline void XMLNotationDecl::setId(const XMLSize_t newId)
187{
188 fId = newId;
189}
190
191inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId)
192{
193 fNameSpaceId = newId;
194}
195
196inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
197{
198 if (fPublicId)
199 fMemoryManager->deallocate(fPublicId);
200
201 fPublicId = XMLString::replicate(newId, fMemoryManager);
202}
203
204inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
205{
206 if (fSystemId)
207 fMemoryManager->deallocate(fSystemId);
208
209 fSystemId = XMLString::replicate(newId, fMemoryManager);
210}
211
212inline 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// ---------------------------------------------------------------------------
224inline const XMLCh* XMLNotationDecl::getKey() const
225{
226 return fName;
227}
228
230
231#endif
#define XMLPARSER_EXPORT
Definition XercesDefs.hpp:163
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
char16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
Configurable memory manager.
Definition MemoryManager.hpp:40
virtual void deallocate(void *p)=0
This method deallocates memory.
This class represents the core information about a notation declaration that all validators must at l...
Definition XMLNotationDecl.hpp:42
XMLNotationDecl(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
MemoryManager * getMemoryManager() const
Definition XMLNotationDecl.hpp:178
void setPublicId(const XMLCh *const newId)
Definition XMLNotationDecl.hpp:196
XMLNotationDecl(const XMLCh *const notName, const XMLCh *const pubId, const XMLCh *const sysId, const XMLCh *const baseURI=0, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
void setNameSpaceId(const unsigned int newId)
Definition XMLNotationDecl.hpp:191
XMLSize_t getId() const
Definition XMLNotationDecl.hpp:148
const XMLCh * getSystemId() const
Definition XMLNotationDecl.hpp:168
const XMLCh * getBaseURI() const
Definition XMLNotationDecl.hpp:173
const XMLCh * getName() const
Definition XMLNotationDecl.hpp:153
unsigned int getNameSpaceId() const
Definition XMLNotationDecl.hpp:158
void setId(const XMLSize_t newId)
Definition XMLNotationDecl.hpp:186
void setSystemId(const XMLCh *const newId)
Definition XMLNotationDecl.hpp:204
const XMLCh * getKey() const
Definition XMLNotationDecl.hpp:224
const XMLCh * getPublicId() const
Definition XMLNotationDecl.hpp:163
void setBaseURI(const XMLCh *const newId)
Definition XMLNotationDecl.hpp:212
void setName(const XMLCh *const notName)
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition PlatformUtils.hpp:121
static char * replicate(const char *const toRep, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Replicates a string NOTE: The returned buffer is allocated with the MemoryManager.
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition XMemory.hpp:41