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_DOMTREEWALKERIMPL_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMTREEWALKERIMPL_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 #include <xercesc/dom/DOMTreeWalker.hpp>
0035 
0036 XERCES_CPP_NAMESPACE_BEGIN
0037 
0038 
0039 class CDOM_EXPORT DOMTreeWalkerImpl : public DOMTreeWalker {
0040 protected:
0041         // The whatToShow mask.
0042         DOMNodeFilter::ShowType fWhatToShow;
0043 
0044         // The NodeFilter reference.
0045         DOMNodeFilter* fNodeFilter;
0046 
0047         // The current Node.
0048         DOMNode* fCurrentNode;
0049 
0050         // The root Node.
0051         DOMNode* fRoot;
0052 
0053         // The expandEntity reference flag.
0054         bool fExpandEntityReferences;
0055 
0056 public:
0057     // Implementation Note: No state is kept except the data above
0058     // (fWhatToShow, fNodeFilter, fCurrentNode, fRoot) such that
0059     // setters could be created for these data values and the
0060     // implementation will still work.
0061 
0062     /** Public constructor */
0063     DOMTreeWalkerImpl (
0064         DOMNode* root,
0065         DOMNodeFilter::ShowType whatToShow,
0066         DOMNodeFilter* nodeFilter,
0067         bool expandEntityRef);
0068     DOMTreeWalkerImpl (const DOMTreeWalkerImpl& twi);
0069     DOMTreeWalkerImpl& operator= (const DOMTreeWalkerImpl& twi);
0070 
0071     // Return the root node.
0072     virtual DOMNode* getRoot ();
0073 
0074     // Return the whatToShow value.
0075     virtual DOMNodeFilter::ShowType  getWhatToShow ();
0076 
0077     // Return the NodeFilter.
0078     virtual DOMNodeFilter* getFilter ();
0079 
0080 
0081     // Return the current DOMNode.
0082     virtual DOMNode* getCurrentNode ();
0083 
0084     // Return the current Node.
0085     virtual void setCurrentNode (DOMNode* node);
0086 
0087     // Return the parent Node from the current node,
0088     //  after applying filter, whatToshow.
0089     //  If result is not null, set the current Node.
0090     virtual DOMNode* parentNode ();
0091 
0092     // Return the first child Node from the current node,
0093     //  after applying filter, whatToshow.
0094     //  If result is not null, set the current Node.
0095     virtual DOMNode* firstChild ();
0096 
0097     // Return the last child Node from the current node,
0098     //  after applying filter, whatToshow.
0099     //  If result is not null, set the current Node.
0100     virtual DOMNode* lastChild ();
0101 
0102     // Return the previous sibling Node from the current node,
0103     //  after applying filter, whatToshow.
0104     //  If result is not null, set the current Node.
0105     virtual DOMNode* previousSibling ();
0106 
0107     // Return the next sibling Node from the current node,
0108     //  after applying filter, whatToshow.
0109     //  If result is not null, set the current Node.
0110 
0111     virtual DOMNode* nextSibling ();
0112     // Return the previous Node from the current node,
0113     //  after applying filter, whatToshow.
0114     //  If result is not null, set the current Node.
0115     virtual DOMNode* previousNode ();
0116 
0117     // Return the next Node from the current node,
0118     //  after applying filter, whatToshow.
0119     //  If result is not null, set the current Node.
0120     virtual DOMNode* nextNode ();
0121 
0122     // Get the expandEntity reference flag.
0123     virtual bool getExpandEntityReferences();
0124 
0125     // release the resource
0126     virtual void release();
0127 
0128 protected:
0129 
0130     // Internal function.
0131     //  Return the parent Node, from the input node
0132     //  after applying filter, whatToshow.
0133     //  The current node is not consulted or set.
0134     DOMNode* getParentNode (DOMNode* node);
0135 
0136     // Internal function.
0137     //  Return the nextSibling Node, from the input node
0138     //  after applying filter, whatToshow.
0139     //  The current node is not consulted or set.
0140     DOMNode* getNextSibling (DOMNode* node);
0141 
0142     // Internal function.
0143     //  Return the previous sibling Node, from the input node
0144     //  after applying filter, whatToshow.
0145     //  The current node is not consulted or set.
0146     DOMNode* getPreviousSibling (DOMNode* node);
0147 
0148     // Internal function.
0149     //  Return the first child Node, from the input node
0150     //  after applying filter, whatToshow.
0151     //  The current node is not consulted or set.
0152     DOMNode* getFirstChild (DOMNode* node);
0153 
0154     // Internal function.
0155     //  Return the last child Node, from the input node
0156     //  after applying filter, whatToshow.
0157     //  The current node is not consulted or set.
0158     DOMNode* getLastChild (DOMNode* node);
0159 
0160     // The node is accepted if it passes the whatToShow and the filter.
0161     short acceptNode (DOMNode* node);
0162 
0163 
0164 };
0165 
0166 XERCES_CPP_NAMESPACE_END
0167 
0168 #endif