|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 /* |
|
18 * Licensed to the Apache Software Foundation (ASF) under one or more |
|
19 * contributor license agreements. See the NOTICE file distributed with |
|
20 * this work for additional information regarding copyright ownership. |
|
21 * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
22 * (the "License"); you may not use this file except in compliance with |
|
23 * the License. You may obtain a copy of the License at |
|
24 * |
|
25 * http://www.apache.org/licenses/LICENSE-2.0 |
|
26 * |
|
27 * Unless required by applicable law or agreed to in writing, software |
|
28 * distributed under the License is distributed on an "AS IS" BASIS, |
|
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
30 * See the License for the specific language governing permissions and |
|
31 * limitations under the License. |
|
32 */ |
|
33 |
|
34 /* |
|
35 * $Id: XMLNotationDecl.hpp 568078 2007-08-21 11:43:25Z amassari $ |
|
36 */ |
|
37 |
|
38 #if !defined(XMLNOTATIONDECL_HPP) |
|
39 #define XMLNOTATIONDECL_HPP |
|
40 |
|
41 #include <xercesc/util/XMemory.hpp> |
|
42 #include <xercesc/util/PlatformUtils.hpp> |
|
43 #include <xercesc/util/XMLString.hpp> |
|
44 #include <xercesc/internal/XSerializable.hpp> |
|
45 |
|
46 XERCES_CPP_NAMESPACE_BEGIN |
|
47 |
|
48 /** |
|
49 * This class represents the core information about a notation declaration |
|
50 * that all validators must at least support. Each validator will create a |
|
51 * derivative of this class which adds any information it requires for its |
|
52 * own extra needs. |
|
53 * |
|
54 * At this common level, the information supported is the notation name |
|
55 * and the public and sysetm ids indicated in the notation declaration. |
|
56 */ |
|
57 class XMLPARSER_EXPORT XMLNotationDecl : public XSerializable, public XMemory |
|
58 { |
|
59 public: |
|
60 // ----------------------------------------------------------------------- |
|
61 // Constructors and Destructor |
|
62 // ----------------------------------------------------------------------- |
|
63 |
|
64 /** @name Constructors */ |
|
65 //@{ |
|
66 XMLNotationDecl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager); |
|
67 XMLNotationDecl |
|
68 ( |
|
69 const XMLCh* const notName |
|
70 , const XMLCh* const pubId |
|
71 , const XMLCh* const sysId |
|
72 , const XMLCh* const baseURI = 0 |
|
73 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager |
|
74 ); |
|
75 //@} |
|
76 |
|
77 /** @name Destructor */ |
|
78 //@{ |
|
79 ~XMLNotationDecl(); |
|
80 //@} |
|
81 |
|
82 |
|
83 // ----------------------------------------------------------------------- |
|
84 // Getter methods |
|
85 // ----------------------------------------------------------------------- |
|
86 unsigned int getId() const; |
|
87 const XMLCh* getName() const; |
|
88 const XMLCh* getPublicId() const; |
|
89 const XMLCh* getSystemId() const; |
|
90 const XMLCh* getBaseURI() const; |
|
91 unsigned int getNameSpaceId() const; |
|
92 MemoryManager* getMemoryManager() const; |
|
93 |
|
94 |
|
95 // ----------------------------------------------------------------------- |
|
96 // Setter methods |
|
97 // ----------------------------------------------------------------------- |
|
98 void setId(const unsigned int newId); |
|
99 void setName |
|
100 ( |
|
101 const XMLCh* const notName |
|
102 ); |
|
103 void setPublicId(const XMLCh* const newId); |
|
104 void setSystemId(const XMLCh* const newId); |
|
105 void setBaseURI(const XMLCh* const newId); |
|
106 void setNameSpaceId(const unsigned int newId); |
|
107 |
|
108 // ----------------------------------------------------------------------- |
|
109 // Support named collection element semantics |
|
110 // ----------------------------------------------------------------------- |
|
111 const XMLCh* getKey() const; |
|
112 |
|
113 /*** |
|
114 * Support for Serialization/De-serialization |
|
115 ***/ |
|
116 DECL_XSERIALIZABLE(XMLNotationDecl) |
|
117 |
|
118 private : |
|
119 // ----------------------------------------------------------------------- |
|
120 // Unimplemented constructors and operators |
|
121 // ----------------------------------------------------------------------- |
|
122 XMLNotationDecl(const XMLNotationDecl&); |
|
123 XMLNotationDecl& operator=(const XMLNotationDecl&); |
|
124 |
|
125 |
|
126 // ----------------------------------------------------------------------- |
|
127 // XMLNotationDecl: Private helper methods |
|
128 // ----------------------------------------------------------------------- |
|
129 void cleanUp(); |
|
130 |
|
131 |
|
132 // ----------------------------------------------------------------------- |
|
133 // Private data members |
|
134 // |
|
135 // fId |
|
136 // This is the unique id given to this notation decl. |
|
137 // |
|
138 // fName |
|
139 // The notation's name, which identifies the type of notation it |
|
140 // applies to. |
|
141 // |
|
142 // fPublicId |
|
143 // The text of the notation's public id, if any. |
|
144 // |
|
145 // fSystemId |
|
146 // The text of the notation's system id, if any. |
|
147 // |
|
148 // fBaseURI |
|
149 // The text of the notation's base URI |
|
150 // ----------------------------------------------------------------------- |
|
151 unsigned int fId; |
|
152 unsigned int fNameSpaceId; |
|
153 XMLCh* fName; |
|
154 XMLCh* fPublicId; |
|
155 XMLCh* fSystemId; |
|
156 XMLCh* fBaseURI; |
|
157 MemoryManager* fMemoryManager; |
|
158 }; |
|
159 |
|
160 |
|
161 // ----------------------------------------------------------------------- |
|
162 // Getter methods |
|
163 // ----------------------------------------------------------------------- |
|
164 inline unsigned int XMLNotationDecl::getId() const |
|
165 { |
|
166 return fId; |
|
167 } |
|
168 |
|
169 inline const XMLCh* XMLNotationDecl::getName() const |
|
170 { |
|
171 return fName; |
|
172 } |
|
173 |
|
174 inline unsigned int XMLNotationDecl::getNameSpaceId() const |
|
175 { |
|
176 return fNameSpaceId; |
|
177 } |
|
178 |
|
179 inline const XMLCh* XMLNotationDecl::getPublicId() const |
|
180 { |
|
181 return fPublicId; |
|
182 } |
|
183 |
|
184 inline const XMLCh* XMLNotationDecl::getSystemId() const |
|
185 { |
|
186 return fSystemId; |
|
187 } |
|
188 |
|
189 inline const XMLCh* XMLNotationDecl::getBaseURI() const |
|
190 { |
|
191 return fBaseURI; |
|
192 } |
|
193 |
|
194 inline MemoryManager* XMLNotationDecl::getMemoryManager() const |
|
195 { |
|
196 return fMemoryManager; |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------- |
|
200 // Setter methods |
|
201 // ----------------------------------------------------------------------- |
|
202 inline void XMLNotationDecl::setId(const unsigned int newId) |
|
203 { |
|
204 fId = newId; |
|
205 } |
|
206 |
|
207 inline void XMLNotationDecl::setNameSpaceId(const unsigned int newId) |
|
208 { |
|
209 fNameSpaceId = newId; |
|
210 } |
|
211 |
|
212 inline void XMLNotationDecl::setPublicId(const XMLCh* const newId) |
|
213 { |
|
214 if (fPublicId) |
|
215 fMemoryManager->deallocate(fPublicId); |
|
216 |
|
217 fPublicId = XMLString::replicate(newId, fMemoryManager); |
|
218 } |
|
219 |
|
220 inline void XMLNotationDecl::setSystemId(const XMLCh* const newId) |
|
221 { |
|
222 if (fSystemId) |
|
223 fMemoryManager->deallocate(fSystemId); |
|
224 |
|
225 fSystemId = XMLString::replicate(newId, fMemoryManager); |
|
226 } |
|
227 |
|
228 inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId) |
|
229 { |
|
230 if (fBaseURI) |
|
231 fMemoryManager->deallocate(fBaseURI); |
|
232 |
|
233 fBaseURI = XMLString::replicate(newId, fMemoryManager); |
|
234 } |
|
235 |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // XMLNotationDecl: Support named pool element semantics |
|
239 // --------------------------------------------------------------------------- |
|
240 inline const XMLCh* XMLNotationDecl::getKey() const |
|
241 { |
|
242 return fName; |
|
243 } |
|
244 |
|
245 XERCES_CPP_NAMESPACE_END |
|
246 |
|
247 #endif |