source: NonGTP/Xerces/xerces/include/xercesc/dom/DOMNodeIterator.hpp @ 358

Revision 358, 7.9 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1#ifndef DOMNodeIterator_HEADER_GUARD_
2#define DOMNodeIterator_HEADER_GUARD_
3
4/*
5 * Copyright 2001-2002,2004 The Apache Software Foundation.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 */
19
20/*
21 * $Id: DOMNodeIterator.hpp,v 1.10 2004/09/26 15:38:02 gareth Exp $
22 */
23
24#include <xercesc/dom/DOMNodeFilter.hpp>
25#include <xercesc/dom/DOMNode.hpp>
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29
30/**
31 * <code>DOMNodeIterators</code> are used to step through a set of nodes, e.g.
32 * the set of nodes in a <code>DOMNodeList</code>, the document subtree
33 * governed by a particular <code>DOMNode</code>, the results of a query, or
34 * any other set of nodes. The set of nodes to be iterated is determined by
35 * the implementation of the <code>DOMNodeIterator</code>. DOM Level 2
36 * specifies a single <code>DOMNodeIterator</code> implementation for
37 * document-order traversal of a document subtree. Instances of these
38 * <code>DOMNodeIterators</code> are created by calling
39 * <code>DOMDocumentTraversal</code><code>.createNodeIterator()</code>.
40 * <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>.
41 * @since DOM Level 2
42 */
43class CDOM_EXPORT DOMNodeIterator
44{
45protected:
46    // -----------------------------------------------------------------------
47    //  Hidden constructors
48    // -----------------------------------------------------------------------
49    /** @name Hidden constructors */
50    //@{   
51    DOMNodeIterator() {};
52    //@}
53
54private:   
55    // -----------------------------------------------------------------------
56    // Unimplemented constructors and operators
57    // -----------------------------------------------------------------------
58    /** @name Unimplemented constructors and operators */
59    //@{
60    DOMNodeIterator(const DOMNodeIterator &);
61    DOMNodeIterator & operator = (const DOMNodeIterator &);
62    //@}
63
64public:
65    // -----------------------------------------------------------------------
66    //  All constructors are hidden, just the destructor is available
67    // -----------------------------------------------------------------------
68    /** @name Destructor */
69    //@{
70    /**
71     * Destructor
72     *
73     */
74    virtual ~DOMNodeIterator() {};
75    //@}
76
77    // -----------------------------------------------------------------------
78    //  Virtual DOMNodeFilter interface
79    // -----------------------------------------------------------------------
80    /** @name Functions introduced in DOM Level 2 */
81    //@{
82    // -----------------------------------------------------------------------
83    //  Getter methods
84    // -----------------------------------------------------------------------
85    /**
86     * The <code>root</code> node of the <code>DOMNodeIterator</code>, as specified
87     * when it was created.
88     * @since DOM Level 2
89     */
90    virtual DOMNode*           getRoot() = 0;
91    /**
92     * Return which node types are presented via the iterator.
93     * This attribute determines which node types are presented via the
94     * <code>DOMNodeIterator</code>. The available set of constants is defined
95     * in the <code>DOMNodeFilter</code> interface.  Nodes not accepted by
96     * <code>whatToShow</code> will be skipped, but their children may still
97     * be considered. Note that this skip takes precedence over the filter,
98     * if any.
99     * @since DOM Level 2
100     *
101     */
102    virtual unsigned long      getWhatToShow() = 0;
103
104    /**
105     * The <code>DOMNodeFilter</code> used to screen nodes.
106     *
107     * @since DOM Level 2
108     */
109    virtual DOMNodeFilter*     getFilter() = 0;
110
111    /**
112     * Return the expandEntityReferences flag.
113     * The value of this flag determines whether the children of entity
114     * reference nodes are visible to the <code>DOMNodeIterator</code>. If
115     * false, these children  and their descendants will be rejected. Note
116     * that this rejection takes precedence over <code>whatToShow</code> and
117     * the filter. Also note that this is currently the only situation where
118     * <code>DOMNodeIterators</code> may reject a complete subtree rather than
119     * skipping individual nodes.
120     * <br>
121     * <br> To produce a view of the document that has entity references
122     * expanded and does not expose the entity reference node itself, use
123     * the <code>whatToShow</code> flags to hide the entity reference node
124     * and set <code>expandEntityReferences</code> to true when creating the
125     * <code>DOMNodeIterator</code>. To produce a view of the document that has
126     * entity reference nodes but no entity expansion, use the
127     * <code>whatToShow</code> flags to show the entity reference node and
128     * set <code>expandEntityReferences</code> to false.
129     *
130     * @since DOM Level 2
131     */
132    virtual bool               getExpandEntityReferences() = 0;
133
134    // -----------------------------------------------------------------------
135    //  Query methods
136    // -----------------------------------------------------------------------
137    /**
138     * Returns the next node in the set and advances the position of the
139     * <code>DOMNodeIterator</code> in the set. After a
140     * <code>DOMNodeIterator</code> is created, the first call to
141     * <code>nextNode()</code> returns the first node in the set.
142     * @return The next <code>DOMNode</code> in the set being iterated over, or
143     *   <code>null</code> if there are no more members in that set.
144     * @exception DOMException
145     *   INVALID_STATE_ERR: Raised if this method is called after the
146     *   <code>detach</code> method was invoked.
147     * @since DOM Level 2
148     */
149    virtual DOMNode*           nextNode() = 0;
150
151    /**
152     * Returns the previous node in the set and moves the position of the
153     * <code>DOMNodeIterator</code> backwards in the set.
154     * @return The previous <code>DOMNode</code> in the set being iterated over,
155     *   or <code>null</code> if there are no more members in that set.
156     * @exception DOMException
157     *   INVALID_STATE_ERR: Raised if this method is called after the
158     *   <code>detach</code> method was invoked.
159     * @since DOM Level 2
160     */
161    virtual DOMNode*           previousNode() = 0;
162
163    /**
164     * Detaches the <code>DOMNodeIterator</code> from the set which it iterated
165     * over, releasing any computational resources and placing the
166     * <code>DOMNodeIterator</code> in the INVALID state. After
167     * <code>detach</code> has been invoked, calls to <code>nextNode</code>
168     * or <code>previousNode</code> will raise the exception
169     * INVALID_STATE_ERR.
170     * @since DOM Level 2
171     */
172    virtual void               detach() = 0;
173    //@}
174
175    // -----------------------------------------------------------------------
176    //  Non-standard Extension
177    // -----------------------------------------------------------------------
178    /** @name Non-standard Extension */
179    //@{
180    /**
181     * Called to indicate that this NodeIterator is no longer in use
182     * and that the implementation may relinquish any resources associated with it.
183     * (release() will call detach() where appropriate)
184     *
185     * Access to a released object will lead to unexpected result.
186     */
187    virtual void               release() = 0;
188    //@}
189};
190
191#define GetDOMNodeIteratorMemoryManager GET_DIRECT_MM(fDocument)
192
193XERCES_CPP_NAMESPACE_END
194
195#endif
Note: See TracBrowser for help on using the repository browser.