1 | #ifndef DOMParentNode_HEADER_GUARD_
|
---|
2 | #define DOMParentNode_HEADER_GUARD_
|
---|
3 |
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * The Apache Software License, Version 1.1
|
---|
7 | *
|
---|
8 | * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
|
---|
9 | * reserved.
|
---|
10 | *
|
---|
11 | * Redistribution and use in source and binary forms, with or without
|
---|
12 | * modification, are permitted provided that the following conditions
|
---|
13 | * are met:
|
---|
14 | *
|
---|
15 | * 1. Redistributions of source code must retain the above copyright
|
---|
16 | * notice, this list of conditions and the following disclaimer.
|
---|
17 | *
|
---|
18 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
19 | * notice, this list of conditions and the following disclaimer in
|
---|
20 | * the documentation and/or other materials provided with the
|
---|
21 | * distribution.
|
---|
22 | *
|
---|
23 | * 3. The end-user documentation included with the redistribution,
|
---|
24 | * if any, must include the following acknowledgment:
|
---|
25 | * "This product includes software developed by the
|
---|
26 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
27 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
28 | * if and wherever such third-party acknowledgments normally appear.
|
---|
29 | *
|
---|
30 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
31 | * not be used to endorse or promote products derived from this
|
---|
32 | * software without prior written permission. For written
|
---|
33 | * permission, please contact apache\@apache.org.
|
---|
34 | *
|
---|
35 | * 5. Products derived from this software may not be called "Apache",
|
---|
36 | * nor may "Apache" appear in their name, without prior written
|
---|
37 | * permission of the Apache Software Foundation.
|
---|
38 | *
|
---|
39 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
40 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
41 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
42 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
45 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
46 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
47 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
48 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
49 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
50 | * SUCH DAMAGE.
|
---|
51 | * ====================================================================
|
---|
52 | *
|
---|
53 | * This software consists of voluntary contributions made by many
|
---|
54 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
55 | * originally based on software copyright (c) 2001, International
|
---|
56 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
57 | * on the Apache Software Foundation, please see
|
---|
58 | * <http://www.apache.org/>.
|
---|
59 | */
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * $Id: DOMParentNode.hpp,v 1.7 2004/01/29 11:44:27 cargilld Exp $
|
---|
63 | */
|
---|
64 |
|
---|
65 | //
|
---|
66 | // This file is part of the internal implementation of the C++ XML DOM.
|
---|
67 | // It should NOT be included or used directly by application programs.
|
---|
68 | //
|
---|
69 | // Applications should include the file <xercesc/dom/DOM.hpp> for the entire
|
---|
70 | // DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
|
---|
71 | // name is substituded for the *.
|
---|
72 | //
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * ParentNode provides the capability of having child
|
---|
76 | * nodes. Not every node in the DOM can have children, so only nodes that can
|
---|
77 | * should include this class and pay the price for it.
|
---|
78 | * <P>
|
---|
79 | * While we have a direct reference to the first child, the last child is
|
---|
80 | * stored as the previous sibling of the first child. First child nodes are
|
---|
81 | * marked as being so, and getNextSibling hides this fact.
|
---|
82 | *
|
---|
83 | **/
|
---|
84 |
|
---|
85 | #include <xercesc/util/XercesDefs.hpp>
|
---|
86 | #include "DOMNodeListImpl.hpp"
|
---|
87 |
|
---|
88 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
89 |
|
---|
90 |
|
---|
91 | class DOMChildNode;
|
---|
92 | class DOMDocument;
|
---|
93 | class DOMNode;
|
---|
94 | class DOMNodeList;
|
---|
95 |
|
---|
96 | class CDOM_EXPORT DOMParentNode {
|
---|
97 | public:
|
---|
98 | DOMDocument *fOwnerDocument; // Document this node belongs to
|
---|
99 | DOMNode *fFirstChild;
|
---|
100 | DOMNodeListImpl fChildNodeList; // for GetChildNodes()
|
---|
101 |
|
---|
102 | public:
|
---|
103 | DOMParentNode(DOMDocument *ownerDocument);
|
---|
104 | DOMParentNode(const DOMParentNode &other);
|
---|
105 |
|
---|
106 | DOMDocument * getOwnerDocument() const;
|
---|
107 | void setOwnerDocument(DOMDocument* doc);
|
---|
108 |
|
---|
109 | // Track changes to the node tree structure under this node. An optimization
|
---|
110 | // for NodeLists.
|
---|
111 | int changes() const;
|
---|
112 | void changed();
|
---|
113 |
|
---|
114 | DOMNode* appendChild(DOMNode *newChild);
|
---|
115 | DOMNodeList* getChildNodes() const;
|
---|
116 | DOMNode* getFirstChild() const;
|
---|
117 | DOMNode* getLastChild() const;
|
---|
118 | XMLSize_t getLength() const;
|
---|
119 | bool hasChildNodes() const;
|
---|
120 | DOMNode* insertBefore(DOMNode *newChild, DOMNode *refChild);
|
---|
121 | DOMNode* item(XMLSize_t index) const;
|
---|
122 | DOMNode* removeChild(DOMNode *oldChild);
|
---|
123 | DOMNode* replaceChild(DOMNode *newChild, DOMNode *oldChild);
|
---|
124 |
|
---|
125 | //Introduced in DOM Level 2
|
---|
126 | void normalize();
|
---|
127 |
|
---|
128 | //Introduced in DOM Level 3
|
---|
129 | bool isEqualNode(const DOMNode* arg) const;
|
---|
130 |
|
---|
131 | // NON-DOM
|
---|
132 | // unlike getOwnerDocument this never returns null, even for Document nodes
|
---|
133 | DOMDocument * getDocument() const;
|
---|
134 | void release();
|
---|
135 |
|
---|
136 |
|
---|
137 | public:
|
---|
138 | void cloneChildren(const DOMNode *other);
|
---|
139 | DOMNode * lastChild() const;
|
---|
140 | void lastChild(DOMNode *);
|
---|
141 |
|
---|
142 | private:
|
---|
143 | // unimplemented
|
---|
144 | DOMParentNode& operator= (const DOMParentNode& other);
|
---|
145 | };
|
---|
146 |
|
---|
147 | XERCES_CPP_NAMESPACE_END
|
---|
148 |
|
---|
149 | #endif
|
---|