|
||||
File indexing completed on 2025-01-18 10:14:51
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_DOMNODEITERATOR_HPP) 0023 #define XERCESC_INCLUDE_GUARD_DOMNODEITERATOR_HPP 0024 0025 #include <xercesc/dom/DOMNodeFilter.hpp> 0026 #include <xercesc/dom/DOMNode.hpp> 0027 0028 XERCES_CPP_NAMESPACE_BEGIN 0029 0030 0031 /** 0032 * <code>DOMNodeIterators</code> are used to step through a set of nodes, e.g. 0033 * the set of nodes in a <code>DOMNodeList</code>, the document subtree 0034 * governed by a particular <code>DOMNode</code>, the results of a query, or 0035 * any other set of nodes. The set of nodes to be iterated is determined by 0036 * the implementation of the <code>DOMNodeIterator</code>. DOM Level 2 0037 * specifies a single <code>DOMNodeIterator</code> implementation for 0038 * document-order traversal of a document subtree. Instances of these 0039 * <code>DOMNodeIterators</code> are created by calling 0040 * <code>DOMDocumentTraversal</code><code>.createNodeIterator()</code>. 0041 * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>. 0042 * @since DOM Level 2 0043 */ 0044 class CDOM_EXPORT DOMNodeIterator 0045 { 0046 protected: 0047 // ----------------------------------------------------------------------- 0048 // Hidden constructors 0049 // ----------------------------------------------------------------------- 0050 /** @name Hidden constructors */ 0051 //@{ 0052 DOMNodeIterator() {} 0053 DOMNodeIterator(const DOMNodeIterator &) {} 0054 //@} 0055 0056 private: 0057 // ----------------------------------------------------------------------- 0058 // Unimplemented constructors and operators 0059 // ----------------------------------------------------------------------- 0060 /** @name Unimplemented operators */ 0061 //@{ 0062 DOMNodeIterator & operator = (const DOMNodeIterator &); 0063 //@} 0064 0065 public: 0066 // ----------------------------------------------------------------------- 0067 // All constructors are hidden, just the destructor is available 0068 // ----------------------------------------------------------------------- 0069 /** @name Destructor */ 0070 //@{ 0071 /** 0072 * Destructor 0073 * 0074 */ 0075 virtual ~DOMNodeIterator() {}; 0076 //@} 0077 0078 // ----------------------------------------------------------------------- 0079 // Virtual DOMNodeFilter interface 0080 // ----------------------------------------------------------------------- 0081 /** @name Functions introduced in DOM Level 2 */ 0082 //@{ 0083 // ----------------------------------------------------------------------- 0084 // Getter methods 0085 // ----------------------------------------------------------------------- 0086 /** 0087 * The <code>root</code> node of the <code>DOMNodeIterator</code>, as specified 0088 * when it was created. 0089 * @since DOM Level 2 0090 */ 0091 virtual DOMNode* getRoot() = 0; 0092 /** 0093 * Return which node types are presented via the iterator. 0094 * This attribute determines which node types are presented via the 0095 * <code>DOMNodeIterator</code>. The available set of constants is defined 0096 * in the <code>DOMNodeFilter</code> interface. Nodes not accepted by 0097 * <code>whatToShow</code> will be skipped, but their children may still 0098 * be considered. Note that this skip takes precedence over the filter, 0099 * if any. 0100 * @since DOM Level 2 0101 * 0102 */ 0103 virtual DOMNodeFilter::ShowType getWhatToShow() = 0; 0104 0105 /** 0106 * The <code>DOMNodeFilter</code> used to screen nodes. 0107 * 0108 * @since DOM Level 2 0109 */ 0110 virtual DOMNodeFilter* getFilter() = 0; 0111 0112 /** 0113 * Return the expandEntityReferences flag. 0114 * The value of this flag determines whether the children of entity 0115 * reference nodes are visible to the <code>DOMNodeIterator</code>. If 0116 * false, these children and their descendants will be rejected. Note 0117 * that this rejection takes precedence over <code>whatToShow</code> and 0118 * the filter. Also note that this is currently the only situation where 0119 * <code>DOMNodeIterators</code> may reject a complete subtree rather than 0120 * skipping individual nodes. 0121 * <br> 0122 * <br> To produce a view of the document that has entity references 0123 * expanded and does not expose the entity reference node itself, use 0124 * the <code>whatToShow</code> flags to hide the entity reference node 0125 * and set <code>expandEntityReferences</code> to true when creating the 0126 * <code>DOMNodeIterator</code>. To produce a view of the document that has 0127 * entity reference nodes but no entity expansion, use the 0128 * <code>whatToShow</code> flags to show the entity reference node and 0129 * set <code>expandEntityReferences</code> to false. 0130 * 0131 * @since DOM Level 2 0132 */ 0133 virtual bool getExpandEntityReferences() = 0; 0134 0135 // ----------------------------------------------------------------------- 0136 // Query methods 0137 // ----------------------------------------------------------------------- 0138 /** 0139 * Returns the next node in the set and advances the position of the 0140 * <code>DOMNodeIterator</code> in the set. After a 0141 * <code>DOMNodeIterator</code> is created, the first call to 0142 * <code>nextNode()</code> returns the first node in the set. 0143 * @return The next <code>DOMNode</code> in the set being iterated over, or 0144 * <code>null</code> if there are no more members in that set. 0145 * @exception DOMException 0146 * INVALID_STATE_ERR: Raised if this method is called after the 0147 * <code>detach</code> method was invoked. 0148 * @since DOM Level 2 0149 */ 0150 virtual DOMNode* nextNode() = 0; 0151 0152 /** 0153 * Returns the previous node in the set and moves the position of the 0154 * <code>DOMNodeIterator</code> backwards in the set. 0155 * @return The previous <code>DOMNode</code> in the set being iterated over, 0156 * or <code>null</code> if there are no more members in that set. 0157 * @exception DOMException 0158 * INVALID_STATE_ERR: Raised if this method is called after the 0159 * <code>detach</code> method was invoked. 0160 * @since DOM Level 2 0161 */ 0162 virtual DOMNode* previousNode() = 0; 0163 0164 /** 0165 * Detaches the <code>DOMNodeIterator</code> from the set which it iterated 0166 * over, releasing any computational resources and placing the 0167 * <code>DOMNodeIterator</code> in the INVALID state. After 0168 * <code>detach</code> has been invoked, calls to <code>nextNode</code> 0169 * or <code>previousNode</code> will raise the exception 0170 * INVALID_STATE_ERR. 0171 * @since DOM Level 2 0172 */ 0173 virtual void detach() = 0; 0174 //@} 0175 0176 // ----------------------------------------------------------------------- 0177 // Non-standard Extension 0178 // ----------------------------------------------------------------------- 0179 /** @name Non-standard Extension */ 0180 //@{ 0181 /** 0182 * Called to indicate that this NodeIterator is no longer in use 0183 * and that the implementation may relinquish any resources associated with it. 0184 * (release() will call detach() where appropriate) 0185 * 0186 * Access to a released object will lead to unexpected result. 0187 */ 0188 virtual void release() = 0; 0189 //@} 0190 }; 0191 0192 #define GetDOMNodeIteratorMemoryManager GET_DIRECT_MM(fDocument) 0193 0194 XERCES_CPP_NAMESPACE_END 0195 0196 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |