1 | /*
|
---|
2 | * The Apache Software License, Version 1.1
|
---|
3 | *
|
---|
4 | * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
|
---|
5 | * reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | *
|
---|
11 | * 1. Redistributions of source code must retain the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer.
|
---|
13 | *
|
---|
14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
15 | * notice, this list of conditions and the following disclaimer in
|
---|
16 | * the documentation and/or other materials provided with the
|
---|
17 | * distribution.
|
---|
18 | *
|
---|
19 | * 3. The end-user documentation included with the redistribution,
|
---|
20 | * if any, must include the following acknowledgment:
|
---|
21 | * "This product includes software developed by the
|
---|
22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
25 | *
|
---|
26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
27 | * not be used to endorse or promote products derived from this
|
---|
28 | * software without prior written permission. For written
|
---|
29 | * permission, please contact apache\@apache.org.
|
---|
30 | *
|
---|
31 | * 5. Products derived from this software may not be called "Apache",
|
---|
32 | * nor may "Apache" appear in their name, without prior written
|
---|
33 | * permission of the Apache Software Foundation.
|
---|
34 | *
|
---|
35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
46 | * SUCH DAMAGE.
|
---|
47 | * ====================================================================
|
---|
48 | *
|
---|
49 | * This software consists of voluntary contributions made by many
|
---|
50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
51 | * originally based on software copyright (c) 1999, International
|
---|
52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
53 | * on the Apache Software Foundation, please see
|
---|
54 | * <http://www.apache.org/>.
|
---|
55 | */
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * $Log: ContentSpecNode.hpp,v $
|
---|
59 | * Revision 1.11 2004/01/29 11:51:21 cargilld
|
---|
60 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
61 | *
|
---|
62 | * Revision 1.10 2003/11/20 17:52:14 knoaman
|
---|
63 | * PSVI: store element declaration (leaf nodes)
|
---|
64 | *
|
---|
65 | * Revision 1.9 2003/11/07 17:08:11 knoaman
|
---|
66 | * For PSVI support, distinguish wildcard elements with namespace lists.
|
---|
67 | *
|
---|
68 | * Revision 1.8 2003/09/26 18:29:27 peiyongz
|
---|
69 | * Implement serialization/deserialization
|
---|
70 | *
|
---|
71 | * Revision 1.7 2003/05/18 14:02:06 knoaman
|
---|
72 | * Memory manager implementation: pass per instance manager.
|
---|
73 | *
|
---|
74 | * Revision 1.6 2003/05/15 18:48:27 knoaman
|
---|
75 | * Partial implementation of the configurable memory manager.
|
---|
76 | *
|
---|
77 | * Revision 1.5 2002/11/04 14:54:58 tng
|
---|
78 | * C++ Namespace Support.
|
---|
79 | *
|
---|
80 | * Revision 1.4 2002/10/30 21:52:00 tng
|
---|
81 | * [Bug 13641] compiler-generated copy-constructor for QName doesn't do the right thing.
|
---|
82 | *
|
---|
83 | * Revision 1.3 2002/04/04 14:42:41 knoaman
|
---|
84 | * Change min/maxOccurs from unsigned int to int.
|
---|
85 | *
|
---|
86 | * Revision 1.2 2002/03/21 15:41:48 knoaman
|
---|
87 | * Move behavior from TraverseSchema.
|
---|
88 | *
|
---|
89 | * Revision 1.1.1.1 2002/02/01 22:22:38 peiyongz
|
---|
90 | * sane_include
|
---|
91 | *
|
---|
92 | * Revision 1.19 2001/12/06 17:50:42 tng
|
---|
93 | * Performance Enhancement. The ContentSpecNode constructor always copied the QName
|
---|
94 | * that was passed to it. Added a second constructor that allows the QName to be just assigned, not copied.
|
---|
95 | * That was because there are some cases in which a temporary QName was constructed, passed to ContentSpecNode, and then deleted.
|
---|
96 | * There were examples of that in TraverseSchema and DTDScanner.
|
---|
97 | * By Henry Zongaro.
|
---|
98 | *
|
---|
99 | * Revision 1.18 2001/11/07 21:50:28 tng
|
---|
100 | * Fix comment log that lead to error.
|
---|
101 | *
|
---|
102 | * Revision 1.17 2001/11/07 21:12:15 tng
|
---|
103 | * Performance: Create QName in ContentSpecNode only if it is a leaf/Any/PCDataNode.
|
---|
104 | *
|
---|
105 | * Revision 1.16 2001/08/28 20:21:08 peiyongz
|
---|
106 | * * AIX 4.2, xlC 3 rev.1 compilation error: get*() declared with external linkage
|
---|
107 | * and called or defined before being declared as inline
|
---|
108 | *
|
---|
109 | * Revision 1.15 2001/08/24 12:48:48 tng
|
---|
110 | * Schema: AllContentModel
|
---|
111 | *
|
---|
112 | * Revision 1.14 2001/08/23 11:54:26 tng
|
---|
113 | * Add newline at the end and various typo fixes.
|
---|
114 | *
|
---|
115 | * Revision 1.13 2001/08/22 16:04:07 tng
|
---|
116 | * ContentSpecNode copy constructor should copy Min and Max as well.
|
---|
117 | *
|
---|
118 | * Revision 1.12 2001/08/21 18:47:42 peiyongz
|
---|
119 | * AIX 4.2, xlC 3 rev.1 compilation error: dtor() declared with external linkage
|
---|
120 | * and called or defined before being declared as inline
|
---|
121 | *
|
---|
122 | * Revision 1.11 2001/08/21 16:06:11 tng
|
---|
123 | * Schema: Unique Particle Attribution Constraint Checking.
|
---|
124 | *
|
---|
125 | * Revision 1.10 2001/08/20 13:18:58 tng
|
---|
126 | * bug in ContentSpecNode copy constructor.
|
---|
127 | *
|
---|
128 | * Revision 1.9 2001/07/24 18:33:13 knoaman
|
---|
129 | * Added support for <group> + extra constraint checking for complexType
|
---|
130 | *
|
---|
131 | * Revision 1.8 2001/07/09 15:22:36 knoaman
|
---|
132 | * complete <any> declaration.
|
---|
133 | *
|
---|
134 | * Revision 1.7 2001/05/11 13:27:18 tng
|
---|
135 | * Copyright update.
|
---|
136 | *
|
---|
137 | * Revision 1.6 2001/05/10 16:33:08 knoaman
|
---|
138 | * Traverse Schema Part III + error messages.
|
---|
139 | *
|
---|
140 | * Revision 1.5 2001/05/03 20:34:39 tng
|
---|
141 | * Schema: SchemaValidator update
|
---|
142 | *
|
---|
143 | * Revision 1.4 2001/04/19 18:17:29 tng
|
---|
144 | * Schema: SchemaValidator update, and use QName in Content Model
|
---|
145 | *
|
---|
146 | * Revision 1.3 2001/03/21 21:56:26 tng
|
---|
147 | * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
|
---|
148 | *
|
---|
149 | * Revision 1.2 2001/02/27 14:48:49 tng
|
---|
150 | * Schema: Add CMAny and ContentLeafNameTypeVector, by Pei Yong Zhang
|
---|
151 | *
|
---|
152 | * Revision 1.1 2001/02/16 14:17:29 tng
|
---|
153 | * Schema: Move the common Content Model files that are shared by DTD
|
---|
154 | * and schema from 'DTD' folder to 'common' folder. By Pei Yong Zhang.
|
---|
155 | *
|
---|
156 | * Revision 1.4 2000/03/02 19:55:38 roddey
|
---|
157 | * This checkin includes many changes done while waiting for the
|
---|
158 | * 1.1.0 code to be finished. I can't list them all here, but a list is
|
---|
159 | * available elsewhere.
|
---|
160 | *
|
---|
161 | * Revision 1.3 2000/02/24 20:16:48 abagchi
|
---|
162 | * Swat for removing Log from API docs
|
---|
163 | *
|
---|
164 | * Revision 1.2 2000/02/09 21:42:37 abagchi
|
---|
165 | * Copyright swat
|
---|
166 | *
|
---|
167 | * Revision 1.1.1.1 1999/11/09 01:03:14 twl
|
---|
168 | * Initial checkin
|
---|
169 | *
|
---|
170 | * Revision 1.2 1999/11/08 20:45:38 rahul
|
---|
171 | * Swat for adding in Product name and CVS comment log variable.
|
---|
172 | *
|
---|
173 | */
|
---|
174 |
|
---|
175 |
|
---|
176 | #if !defined(CONTENTSPECNODE_HPP)
|
---|
177 | #define CONTENTSPECNODE_HPP
|
---|
178 |
|
---|
179 | #include <xercesc/framework/XMLElementDecl.hpp>
|
---|
180 | #include <xercesc/framework/MemoryManager.hpp>
|
---|
181 |
|
---|
182 | #include <xercesc/internal/XSerializable.hpp>
|
---|
183 |
|
---|
184 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
185 |
|
---|
186 | class XMLBuffer;
|
---|
187 | class Grammar;
|
---|
188 |
|
---|
189 |
|
---|
190 | class XMLUTIL_EXPORT ContentSpecNode : public XSerializable, public XMemory
|
---|
191 | {
|
---|
192 | public :
|
---|
193 | // -----------------------------------------------------------------------
|
---|
194 | // Class specific types
|
---|
195 | // -----------------------------------------------------------------------
|
---|
196 | enum NodeTypes
|
---|
197 | {
|
---|
198 | Leaf = 0
|
---|
199 | , ZeroOrOne
|
---|
200 | , ZeroOrMore
|
---|
201 | , OneOrMore
|
---|
202 | , Choice
|
---|
203 | , Sequence
|
---|
204 | , Any
|
---|
205 | , Any_Other
|
---|
206 | , Any_NS = 8
|
---|
207 | , All = 9
|
---|
208 | , Any_NS_Choice = 20
|
---|
209 | , ModelGroupSequence = 21
|
---|
210 | , Any_Lax = 22
|
---|
211 | , Any_Other_Lax = 23
|
---|
212 | , Any_NS_Lax = 24
|
---|
213 | , ModelGroupChoice = 36
|
---|
214 | , Any_Skip = 38
|
---|
215 | , Any_Other_Skip = 39
|
---|
216 | , Any_NS_Skip = 40
|
---|
217 |
|
---|
218 | , UnknownType = -1
|
---|
219 | };
|
---|
220 |
|
---|
221 |
|
---|
222 | // -----------------------------------------------------------------------
|
---|
223 | // Constructors and Destructor
|
---|
224 | // -----------------------------------------------------------------------
|
---|
225 | ContentSpecNode(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
226 | ContentSpecNode
|
---|
227 | (
|
---|
228 | QName* const toAdopt
|
---|
229 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
230 | );
|
---|
231 | ContentSpecNode
|
---|
232 | (
|
---|
233 | XMLElementDecl* const elemDecl
|
---|
234 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
235 | );
|
---|
236 | ContentSpecNode
|
---|
237 | (
|
---|
238 | QName* const toAdopt
|
---|
239 | , const bool copyQName
|
---|
240 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
241 | );
|
---|
242 | ContentSpecNode
|
---|
243 | (
|
---|
244 | const NodeTypes type
|
---|
245 | , ContentSpecNode* const firstToAdopt
|
---|
246 | , ContentSpecNode* const secondToAdopt
|
---|
247 | , const bool adoptFirst = true
|
---|
248 | , const bool adoptSecond = true
|
---|
249 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
250 | );
|
---|
251 | ContentSpecNode(const ContentSpecNode&);
|
---|
252 | ~ContentSpecNode();
|
---|
253 |
|
---|
254 | // -----------------------------------------------------------------------
|
---|
255 | // Getter methods
|
---|
256 | // -----------------------------------------------------------------------
|
---|
257 | QName* getElement();
|
---|
258 | const QName* getElement() const;
|
---|
259 | XMLElementDecl* getElementDecl();
|
---|
260 | const XMLElementDecl* getElementDecl() const;
|
---|
261 | ContentSpecNode* getFirst();
|
---|
262 | const ContentSpecNode* getFirst() const;
|
---|
263 | ContentSpecNode* getSecond();
|
---|
264 | const ContentSpecNode* getSecond() const;
|
---|
265 | NodeTypes getType() const;
|
---|
266 | ContentSpecNode* orphanFirst();
|
---|
267 | ContentSpecNode* orphanSecond();
|
---|
268 | int getMinOccurs() const;
|
---|
269 | int getMaxOccurs() const;
|
---|
270 | bool isFirstAdopted() const;
|
---|
271 | bool isSecondAdopted() const;
|
---|
272 |
|
---|
273 |
|
---|
274 | // -----------------------------------------------------------------------
|
---|
275 | // Setter methods
|
---|
276 | // -----------------------------------------------------------------------
|
---|
277 | void setElement(QName* const toAdopt);
|
---|
278 | void setFirst(ContentSpecNode* const toAdopt);
|
---|
279 | void setSecond(ContentSpecNode* const toAdopt);
|
---|
280 | void setType(const NodeTypes type);
|
---|
281 | void setMinOccurs(int min);
|
---|
282 | void setMaxOccurs(int max);
|
---|
283 | void setAdoptFirst(bool adoptFirst);
|
---|
284 | void setAdoptSecond(bool adoptSecond);
|
---|
285 |
|
---|
286 |
|
---|
287 | // -----------------------------------------------------------------------
|
---|
288 | // Miscellaneous
|
---|
289 | // -----------------------------------------------------------------------
|
---|
290 | void formatSpec (XMLBuffer& bufToFill) const;
|
---|
291 | bool hasAllContent();
|
---|
292 | int getMinTotalRange() const;
|
---|
293 | int getMaxTotalRange() const;
|
---|
294 |
|
---|
295 | /***
|
---|
296 | * Support for Serialization/De-serialization
|
---|
297 | ***/
|
---|
298 | DECL_XSERIALIZABLE(ContentSpecNode)
|
---|
299 |
|
---|
300 | private :
|
---|
301 | // -----------------------------------------------------------------------
|
---|
302 | // Unimplemented constructors and operators
|
---|
303 | // -----------------------------------------------------------------------
|
---|
304 | ContentSpecNode& operator=(const ContentSpecNode&);
|
---|
305 |
|
---|
306 |
|
---|
307 | // -----------------------------------------------------------------------
|
---|
308 | // Private Data Members
|
---|
309 | //
|
---|
310 | // fElement
|
---|
311 | // If the type is Leaf/Any*, then this is the qName of the element. If the URI
|
---|
312 | // is fgPCDataElemId, then its a PCData node. Else, it is zero.
|
---|
313 | //
|
---|
314 | // fFirst
|
---|
315 | // fSecond
|
---|
316 | // The optional first and second nodes. The fType field indicates
|
---|
317 | // which of these are valid. The validaty constraints are:
|
---|
318 | //
|
---|
319 | // Leaf = Neither valid
|
---|
320 | // ZeroOrOne, ZeroOrMore = First
|
---|
321 | // Choice, Sequence, All = First and Second
|
---|
322 | // Any* = Neither valid
|
---|
323 | //
|
---|
324 | // fType
|
---|
325 | // The type of node. This controls how many of the child node fields
|
---|
326 | // are used.
|
---|
327 | //
|
---|
328 | // fAdoptFirst
|
---|
329 | // Indicate if this ContentSpecNode adopts the fFirst, and is responsible
|
---|
330 | // for deleting it.
|
---|
331 | //
|
---|
332 | // fAdoptSecond
|
---|
333 | // Indicate if this ContentSpecNode adopts the fSecond, and is responsible
|
---|
334 | // for deleting it.
|
---|
335 | //
|
---|
336 | // fMinOccurs
|
---|
337 | // Indicate the minimum times that this node can occur
|
---|
338 | //
|
---|
339 | // fMaxOccurs
|
---|
340 | // Indicate the maximum times that this node can occur
|
---|
341 | // -1 (Unbounded), default (1)
|
---|
342 | // -----------------------------------------------------------------------
|
---|
343 | MemoryManager* fMemoryManager;
|
---|
344 | QName* fElement;
|
---|
345 | XMLElementDecl* fElementDecl;
|
---|
346 | ContentSpecNode* fFirst;
|
---|
347 | ContentSpecNode* fSecond;
|
---|
348 | NodeTypes fType;
|
---|
349 | bool fAdoptFirst;
|
---|
350 | bool fAdoptSecond;
|
---|
351 | int fMinOccurs;
|
---|
352 | int fMaxOccurs;
|
---|
353 | };
|
---|
354 |
|
---|
355 | // ---------------------------------------------------------------------------
|
---|
356 | // ContentSpecNode: Constructors and Destructor
|
---|
357 | // ---------------------------------------------------------------------------
|
---|
358 | inline ContentSpecNode::ContentSpecNode(MemoryManager* const manager) :
|
---|
359 |
|
---|
360 | fMemoryManager(manager)
|
---|
361 | , fElement(0)
|
---|
362 | , fElementDecl(0)
|
---|
363 | , fFirst(0)
|
---|
364 | , fSecond(0)
|
---|
365 | , fType(ContentSpecNode::Leaf)
|
---|
366 | , fAdoptFirst(true)
|
---|
367 | , fAdoptSecond(true)
|
---|
368 | , fMinOccurs(1)
|
---|
369 | , fMaxOccurs(1)
|
---|
370 | {
|
---|
371 | }
|
---|
372 |
|
---|
373 | inline
|
---|
374 | ContentSpecNode::ContentSpecNode(QName* const element,
|
---|
375 | MemoryManager* const manager) :
|
---|
376 |
|
---|
377 | fMemoryManager(manager)
|
---|
378 | , fElement(0)
|
---|
379 | , fElementDecl(0)
|
---|
380 | , fFirst(0)
|
---|
381 | , fSecond(0)
|
---|
382 | , fType(ContentSpecNode::Leaf)
|
---|
383 | , fAdoptFirst(true)
|
---|
384 | , fAdoptSecond(true)
|
---|
385 | , fMinOccurs(1)
|
---|
386 | , fMaxOccurs(1)
|
---|
387 | {
|
---|
388 | if (element)
|
---|
389 | fElement = new (fMemoryManager) QName(*element);
|
---|
390 | }
|
---|
391 |
|
---|
392 | inline
|
---|
393 | ContentSpecNode::ContentSpecNode(XMLElementDecl* const elemDecl,
|
---|
394 | MemoryManager* const manager) :
|
---|
395 |
|
---|
396 | fMemoryManager(manager)
|
---|
397 | , fElement(0)
|
---|
398 | , fElementDecl(elemDecl)
|
---|
399 | , fFirst(0)
|
---|
400 | , fSecond(0)
|
---|
401 | , fType(ContentSpecNode::Leaf)
|
---|
402 | , fAdoptFirst(true)
|
---|
403 | , fAdoptSecond(true)
|
---|
404 | , fMinOccurs(1)
|
---|
405 | , fMaxOccurs(1)
|
---|
406 | {
|
---|
407 | if (elemDecl)
|
---|
408 | fElement = new (manager) QName(*(elemDecl->getElementName()));
|
---|
409 | }
|
---|
410 |
|
---|
411 | inline
|
---|
412 | ContentSpecNode::ContentSpecNode( QName* const element
|
---|
413 | , const bool copyQName
|
---|
414 | , MemoryManager* const manager) :
|
---|
415 |
|
---|
416 | fMemoryManager(manager)
|
---|
417 | , fElement(0)
|
---|
418 | , fElementDecl(0)
|
---|
419 | , fFirst(0)
|
---|
420 | , fSecond(0)
|
---|
421 | , fType(ContentSpecNode::Leaf)
|
---|
422 | , fAdoptFirst(true)
|
---|
423 | , fAdoptSecond(true)
|
---|
424 | , fMinOccurs(1)
|
---|
425 | , fMaxOccurs(1)
|
---|
426 | {
|
---|
427 | if (copyQName)
|
---|
428 | {
|
---|
429 | if (element)
|
---|
430 | fElement = new (fMemoryManager) QName(*element);
|
---|
431 | }
|
---|
432 | else
|
---|
433 | {
|
---|
434 | fElement = element;
|
---|
435 | }
|
---|
436 | }
|
---|
437 |
|
---|
438 | inline
|
---|
439 | ContentSpecNode::ContentSpecNode(const NodeTypes type
|
---|
440 | , ContentSpecNode* const firstAdopt
|
---|
441 | , ContentSpecNode* const secondAdopt
|
---|
442 | , const bool adoptFirst
|
---|
443 | , const bool adoptSecond
|
---|
444 | , MemoryManager* const manager) :
|
---|
445 |
|
---|
446 | fMemoryManager(manager)
|
---|
447 | , fElement(0)
|
---|
448 | , fElementDecl(0)
|
---|
449 | , fFirst(firstAdopt)
|
---|
450 | , fSecond(secondAdopt)
|
---|
451 | , fType(type)
|
---|
452 | , fAdoptFirst(adoptFirst)
|
---|
453 | , fAdoptSecond(adoptSecond)
|
---|
454 | , fMinOccurs(1)
|
---|
455 | , fMaxOccurs(1)
|
---|
456 | {
|
---|
457 | }
|
---|
458 |
|
---|
459 | inline ContentSpecNode::~ContentSpecNode()
|
---|
460 | {
|
---|
461 | // Delete our children, which cause recursive cleanup
|
---|
462 | if (fAdoptFirst) {
|
---|
463 | delete fFirst;
|
---|
464 | }
|
---|
465 |
|
---|
466 | if (fAdoptSecond) {
|
---|
467 | delete fSecond;
|
---|
468 | }
|
---|
469 |
|
---|
470 | delete fElement;
|
---|
471 | }
|
---|
472 |
|
---|
473 | // ---------------------------------------------------------------------------
|
---|
474 | // ContentSpecNode: Getter methods
|
---|
475 | // ---------------------------------------------------------------------------
|
---|
476 | inline QName* ContentSpecNode::getElement()
|
---|
477 | {
|
---|
478 | return fElement;
|
---|
479 | }
|
---|
480 |
|
---|
481 | inline const QName* ContentSpecNode::getElement() const
|
---|
482 | {
|
---|
483 | return fElement;
|
---|
484 | }
|
---|
485 |
|
---|
486 | inline XMLElementDecl* ContentSpecNode::getElementDecl()
|
---|
487 | {
|
---|
488 | return fElementDecl;
|
---|
489 | }
|
---|
490 |
|
---|
491 | inline const XMLElementDecl* ContentSpecNode::getElementDecl() const
|
---|
492 | {
|
---|
493 | return fElementDecl;
|
---|
494 | }
|
---|
495 |
|
---|
496 | inline ContentSpecNode* ContentSpecNode::getFirst()
|
---|
497 | {
|
---|
498 | return fFirst;
|
---|
499 | }
|
---|
500 |
|
---|
501 | inline const ContentSpecNode* ContentSpecNode::getFirst() const
|
---|
502 | {
|
---|
503 | return fFirst;
|
---|
504 | }
|
---|
505 |
|
---|
506 | inline ContentSpecNode* ContentSpecNode::getSecond()
|
---|
507 | {
|
---|
508 | return fSecond;
|
---|
509 | }
|
---|
510 |
|
---|
511 | inline const ContentSpecNode* ContentSpecNode::getSecond() const
|
---|
512 | {
|
---|
513 | return fSecond;
|
---|
514 | }
|
---|
515 |
|
---|
516 | inline ContentSpecNode::NodeTypes ContentSpecNode::getType() const
|
---|
517 | {
|
---|
518 | return fType;
|
---|
519 | }
|
---|
520 |
|
---|
521 | inline ContentSpecNode* ContentSpecNode::orphanFirst()
|
---|
522 | {
|
---|
523 | ContentSpecNode* retNode = fFirst;
|
---|
524 | fFirst = 0;
|
---|
525 | return retNode;
|
---|
526 | }
|
---|
527 |
|
---|
528 | inline ContentSpecNode* ContentSpecNode::orphanSecond()
|
---|
529 | {
|
---|
530 | ContentSpecNode* retNode = fSecond;
|
---|
531 | fSecond = 0;
|
---|
532 | return retNode;
|
---|
533 | }
|
---|
534 |
|
---|
535 | inline int ContentSpecNode::getMinOccurs() const
|
---|
536 | {
|
---|
537 | return fMinOccurs;
|
---|
538 | }
|
---|
539 |
|
---|
540 | inline int ContentSpecNode::getMaxOccurs() const
|
---|
541 | {
|
---|
542 | return fMaxOccurs;
|
---|
543 | }
|
---|
544 |
|
---|
545 | inline bool ContentSpecNode::isFirstAdopted() const
|
---|
546 | {
|
---|
547 | return fAdoptFirst;
|
---|
548 | }
|
---|
549 |
|
---|
550 | inline bool ContentSpecNode::isSecondAdopted() const
|
---|
551 | {
|
---|
552 | return fAdoptSecond;
|
---|
553 | }
|
---|
554 |
|
---|
555 |
|
---|
556 | // ---------------------------------------------------------------------------
|
---|
557 | // ContentSpecType: Setter methods
|
---|
558 | // ---------------------------------------------------------------------------
|
---|
559 | inline void ContentSpecNode::setElement(QName* const element)
|
---|
560 | {
|
---|
561 | delete fElement;
|
---|
562 | fElement = 0;
|
---|
563 | if (element)
|
---|
564 | fElement = new (fMemoryManager) QName(*element);
|
---|
565 | }
|
---|
566 |
|
---|
567 | inline void ContentSpecNode::setFirst(ContentSpecNode* const toAdopt)
|
---|
568 | {
|
---|
569 | if (fAdoptFirst)
|
---|
570 | delete fFirst;
|
---|
571 | fFirst = toAdopt;
|
---|
572 | }
|
---|
573 |
|
---|
574 | inline void ContentSpecNode::setSecond(ContentSpecNode* const toAdopt)
|
---|
575 | {
|
---|
576 | if (fAdoptSecond)
|
---|
577 | delete fSecond;
|
---|
578 | fSecond = toAdopt;
|
---|
579 | }
|
---|
580 |
|
---|
581 | inline void ContentSpecNode::setType(const NodeTypes type)
|
---|
582 | {
|
---|
583 | fType = type;
|
---|
584 | }
|
---|
585 |
|
---|
586 | inline void ContentSpecNode::setMinOccurs(int min)
|
---|
587 | {
|
---|
588 | fMinOccurs = min;
|
---|
589 | }
|
---|
590 |
|
---|
591 | inline void ContentSpecNode::setMaxOccurs(int max)
|
---|
592 | {
|
---|
593 | fMaxOccurs = max;
|
---|
594 | }
|
---|
595 |
|
---|
596 | inline void ContentSpecNode::setAdoptFirst(bool newState)
|
---|
597 | {
|
---|
598 | fAdoptFirst = newState;
|
---|
599 | }
|
---|
600 |
|
---|
601 | inline void ContentSpecNode::setAdoptSecond(bool newState)
|
---|
602 | {
|
---|
603 | fAdoptSecond = newState;
|
---|
604 | }
|
---|
605 |
|
---|
606 | // ---------------------------------------------------------------------------
|
---|
607 | // ContentSpecNode: Miscellaneous
|
---|
608 | // ---------------------------------------------------------------------------
|
---|
609 | inline bool ContentSpecNode::hasAllContent() {
|
---|
610 |
|
---|
611 | if (fType == ContentSpecNode::ZeroOrOne) {
|
---|
612 | return (fFirst->getType() == ContentSpecNode::All);
|
---|
613 | }
|
---|
614 |
|
---|
615 | return (fType == ContentSpecNode::All);
|
---|
616 | }
|
---|
617 |
|
---|
618 | XERCES_CPP_NAMESPACE_END
|
---|
619 |
|
---|
620 | #endif
|
---|