source: NonGTP/Xerces/xercesc/dom/DOMNodeIterator.hpp @ 188

Revision 188, 9.9 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1#ifndef DOMNodeIterator_HEADER_GUARD_
2#define DOMNodeIterator_HEADER_GUARD_
3
4/*
5 * The Apache Software License, Version 1.1
6 *
7 * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
8 * reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions and the following disclaimer.
16 *
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in
19 *    the documentation and/or other materials provided with the
20 *    distribution.
21 *
22 * 3. The end-user documentation included with the redistribution,
23 *    if any, must include the following acknowledgment:
24 *       "This product includes software developed by the
25 *        Apache Software Foundation (http://www.apache.org/)."
26 *    Alternately, this acknowledgment may appear in the software itself,
27 *    if and wherever such third-party acknowledgments normally appear.
28 *
29 * 4. The names "Xerces" and "Apache Software Foundation" must
30 *    not be used to endorse or promote products derived from this
31 *    software without prior written permission. For written
32 *    permission, please contact apache\@apache.org.
33 *
34 * 5. Products derived from this software may not be called "Apache",
35 *    nor may "Apache" appear in their name, without prior written
36 *    permission of the Apache Software Foundation.
37 *
38 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
42 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
45 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 * ====================================================================
51 *
52 * This software consists of voluntary contributions made by many
53 * individuals on behalf of the Apache Software Foundation, and was
54 * originally based on software copyright (c) 2001, International
55 * Business Machines, Inc., http://www.ibm.com .  For more information
56 * on the Apache Software Foundation, please see
57 * <http://www.apache.org/>.
58 */
59
60/*
61 * $Id: DOMNodeIterator.hpp,v 1.7 2003/03/07 19:59:07 tng Exp $
62 */
63
64#include "DOMNodeFilter.hpp"
65#include "DOMNode.hpp"
66
67XERCES_CPP_NAMESPACE_BEGIN
68
69
70/**
71 * <code>DOMNodeIterators</code> are used to step through a set of nodes, e.g.
72 * the set of nodes in a <code>DOMNodeList</code>, the document subtree
73 * governed by a particular <code>DOMNode</code>, the results of a query, or
74 * any other set of nodes. The set of nodes to be iterated is determined by
75 * the implementation of the <code>DOMNodeIterator</code>. DOM Level 2
76 * specifies a single <code>DOMNodeIterator</code> implementation for
77 * document-order traversal of a document subtree. Instances of these
78 * <code>DOMNodeIterators</code> are created by calling
79 * <code>DOMDocumentTraversal</code><code>.createNodeIterator()</code>.
80 * <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>.
81 * @since DOM Level 2
82 */
83class CDOM_EXPORT DOMNodeIterator
84{
85protected:
86    // -----------------------------------------------------------------------
87    //  Hidden constructors
88    // -----------------------------------------------------------------------
89    /** @name Hidden constructors */
90    //@{   
91    DOMNodeIterator() {};
92    //@}
93
94private:   
95    // -----------------------------------------------------------------------
96    // Unimplemented constructors and operators
97    // -----------------------------------------------------------------------
98    /** @name Unimplemented constructors and operators */
99    //@{
100    DOMNodeIterator(const DOMNodeIterator &);
101    DOMNodeIterator & operator = (const DOMNodeIterator &);
102    //@}
103
104public:
105    // -----------------------------------------------------------------------
106    //  All constructors are hidden, just the destructor is available
107    // -----------------------------------------------------------------------
108    /** @name Destructor */
109    //@{
110    /**
111     * Destructor
112     *
113     */
114    virtual ~DOMNodeIterator() {};
115    //@}
116
117    // -----------------------------------------------------------------------
118    //  Virtual DOMNodeFilter interface
119    // -----------------------------------------------------------------------
120    /** @name Functions introduced in DOM Level 2 */
121    //@{
122    // -----------------------------------------------------------------------
123    //  Getter methods
124    // -----------------------------------------------------------------------
125    /**
126     * The <code>root</code> node of the <code>DOMNodeIterator</code>, as specified
127     * when it was created.
128     * @since DOM Level 2
129     */
130    virtual DOMNode*           getRoot() = 0;
131    /**
132     * Return which node types are presented via the iterator.
133     * This attribute determines which node types are presented via the
134     * <code>DOMNodeIterator</code>. The available set of constants is defined
135     * in the <code>DOMNodeFilter</code> interface.  Nodes not accepted by
136     * <code>whatToShow</code> will be skipped, but their children may still
137     * be considered. Note that this skip takes precedence over the filter,
138     * if any.
139     * @since DOM Level 2
140     *
141     */
142    virtual unsigned long      getWhatToShow() = 0;
143
144    /**
145     * The <code>DOMNodeFilter</code> used to screen nodes.
146     *
147     * @since DOM Level 2
148     */
149    virtual DOMNodeFilter*     getFilter() = 0;
150
151    /**
152     * Return the expandEntityReferences flag.
153     * The value of this flag determines whether the children of entity
154     * reference nodes are visible to the <code>DOMNodeIterator</code>. If
155     * false, these children  and their descendants will be rejected. Note
156     * that this rejection takes precedence over <code>whatToShow</code> and
157     * the filter. Also note that this is currently the only situation where
158     * <code>DOMNodeIterators</code> may reject a complete subtree rather than
159     * skipping individual nodes.
160     * <br>
161     * <br> To produce a view of the document that has entity references
162     * expanded and does not expose the entity reference node itself, use
163     * the <code>whatToShow</code> flags to hide the entity reference node
164     * and set <code>expandEntityReferences</code> to true when creating the
165     * <code>DOMNodeIterator</code>. To produce a view of the document that has
166     * entity reference nodes but no entity expansion, use the
167     * <code>whatToShow</code> flags to show the entity reference node and
168     * set <code>expandEntityReferences</code> to false.
169     *
170     * @since DOM Level 2
171     */
172    virtual bool               getExpandEntityReferences() = 0;
173
174    // -----------------------------------------------------------------------
175    //  Query methods
176    // -----------------------------------------------------------------------
177    /**
178     * Returns the next node in the set and advances the position of the
179     * <code>DOMNodeIterator</code> in the set. After a
180     * <code>DOMNodeIterator</code> is created, the first call to
181     * <code>nextNode()</code> returns the first node in the set.
182     * @return The next <code>DOMNode</code> in the set being iterated over, or
183     *   <code>null</code> if there are no more members in that set.
184     * @exception DOMException
185     *   INVALID_STATE_ERR: Raised if this method is called after the
186     *   <code>detach</code> method was invoked.
187     * @since DOM Level 2
188     */
189    virtual DOMNode*           nextNode() = 0;
190
191    /**
192     * Returns the previous node in the set and moves the position of the
193     * <code>DOMNodeIterator</code> backwards in the set.
194     * @return The previous <code>DOMNode</code> in the set being iterated over,
195     *   or <code>null</code> if there are no more members in that set.
196     * @exception DOMException
197     *   INVALID_STATE_ERR: Raised if this method is called after the
198     *   <code>detach</code> method was invoked.
199     * @since DOM Level 2
200     */
201    virtual DOMNode*           previousNode() = 0;
202
203    /**
204     * Detaches the <code>DOMNodeIterator</code> from the set which it iterated
205     * over, releasing any computational resources and placing the
206     * <code>DOMNodeIterator</code> in the INVALID state. After
207     * <code>detach</code> has been invoked, calls to <code>nextNode</code>
208     * or <code>previousNode</code> will raise the exception
209     * INVALID_STATE_ERR.
210     * @since DOM Level 2
211     */
212    virtual void               detach() = 0;
213    //@}
214
215    // -----------------------------------------------------------------------
216    //  Non-standard Extension
217    // -----------------------------------------------------------------------
218    /** @name Non-standard Extension */
219    //@{
220    /**
221     * Called to indicate that this NodeIterator is no longer in use
222     * and that the implementation may relinquish any resources associated with it.
223     * (release() will call detach() where appropriate)
224     *
225     * Access to a released object will lead to unexpected result.
226     */
227    virtual void               release() = 0;
228    //@}
229};
230
231XERCES_CPP_NAMESPACE_END
232
233#endif
Note: See TracBrowser for help on using the repository browser.