Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:02

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMPARENTNODE_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMPARENTNODE_HPP
0024 
0025 //
0026 //  This file is part of the internal implementation of the C++ XML DOM.
0027 //  It should NOT be included or used directly by application programs.
0028 //
0029 //  Applications should include the file <xercesc/dom/DOM.hpp> for the entire
0030 //  DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class
0031 //  name is substituded for the *.
0032 //
0033 
0034 /**
0035  * ParentNode provides the capability of having child
0036  * nodes. Not every node in the DOM can have children, so only nodes that can
0037  * should include this class and pay the price for it.
0038  * <P>
0039  * While we have a direct reference to the first child, the last child is
0040  * stored as the previous sibling of the first child. First child nodes are
0041  * marked as being so, and getNextSibling hides this fact.
0042  *
0043  **/
0044 
0045 #include <xercesc/util/XercesDefs.hpp>
0046 #include "DOMNodeListImpl.hpp"
0047 
0048 XERCES_CPP_NAMESPACE_BEGIN
0049 
0050 
0051 class DOMChildNode;
0052 class DOMDocument;
0053 class DOMNode;
0054 class DOMNodeList;
0055 
0056 class CDOM_EXPORT DOMParentNode  {
0057 public:
0058     DOMNode                *fContainingNode; // the impl object that we're contained by
0059     DOMDocument            *fOwnerDocument; // Document this node belongs to
0060     DOMNode                *fFirstChild;
0061     DOMNodeListImpl            fChildNodeList;      // for GetChildNodes()
0062 
0063 public:
0064     DOMParentNode(DOMNode* containingNode, DOMDocument *ownerDocument);
0065     DOMParentNode(DOMNode* containingNode, const DOMParentNode &other);
0066     ~DOMParentNode();
0067 
0068 private:
0069     // Make sure this can't be called to corrupt the containing node ptr.
0070     DOMParentNode(const DOMParentNode &other);
0071 
0072     DOMNode* getContainingNode();
0073     const DOMNode* getContainingNode() const;
0074     const DOMNodeImpl* getContainingNodeImpl() const;
0075 
0076 public:
0077     DOMDocument * getOwnerDocument() const;
0078     void setOwnerDocument(DOMDocument* doc);
0079 
0080     // Track changes to the node tree structure under this node.  An optimization
0081     //   for NodeLists.
0082     int changes() const;
0083     void changed();
0084 
0085     DOMNode*     appendChild(DOMNode *newChild);
0086     DOMNodeList* getChildNodes() const;
0087     DOMNode*     getFirstChild() const;
0088     DOMNode*     getLastChild() const;
0089     bool         hasChildNodes() const;
0090     DOMNode*     insertBefore(DOMNode *newChild, DOMNode *refChild);
0091     DOMNode*     item(unsigned int index) const;
0092     DOMNode*     removeChild(DOMNode *oldChild);
0093     DOMNode*     replaceChild(DOMNode *newChild, DOMNode *oldChild);
0094 
0095     // Append certain types of nodes fast. Used to speed up XML to DOM
0096     // parsing. See the function implementation for detail.
0097     virtual DOMNode*     appendChildFast(DOMNode *newChild);
0098 
0099     //Introduced in DOM Level 2
0100     void    normalize();
0101 
0102     //Introduced in DOM Level 3
0103     bool isEqualNode(const DOMNode* arg) const;
0104 
0105     // NON-DOM
0106     // unlike getOwnerDocument this never returns null, even for Document nodes
0107     DOMDocument * getDocument() const;
0108     void          release();
0109 
0110 
0111 public:
0112     void cloneChildren(const DOMNode *other);
0113     DOMNode * lastChild() const;
0114     void lastChild(DOMNode *);
0115 
0116 private:
0117     // unimplemented
0118     DOMParentNode& operator= (const DOMParentNode& other);
0119 };
0120 
0121 #define GetDOMParentNodeMemoryManager GET_DIRECT_MM(fOwnerDocument)
0122 
0123 XERCES_CPP_NAMESPACE_END
0124 
0125 #endif