source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/dom/deprecated/DOM_NodeIterator.hpp @ 2674

Revision 2674, 5.9 KB checked in by mattausch, 16 years ago (diff)
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: DOM_NodeIterator.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22#ifndef DOM_NodeIterator_HEADER_GUARD_
23#define DOM_NodeIterator_HEADER_GUARD_
24
25#include "DOM_NodeFilter.hpp"
26#include "DOM_Node.hpp"
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30
31class NodeIteratorImpl;
32
33/**
34 * NodeIterators are used to step through a set of nodes
35 * e.g. the set of nodes in a NodeList, the document subtree governed by
36 * a particular node, the results of a query, or any other set of nodes.
37 * The set of nodes to be iterated is determined by the implementation
38 * of the NodeIterator. DOM Level 2 specifies a single NodeIterator
39 * implementation for document-order traversal of a document
40 * subtree. Instances of these iterators are created by calling
41 * <code>DocumentTraversal.createNodeIterator()</code>.
42 *
43 */
44class DEPRECATED_DOM_EXPORT DOM_NodeIterator
45{
46    public:
47        /** @name Constructors and assignment operator */
48        //@{
49        /**
50          * Default constructor.
51          */
52        DOM_NodeIterator ();
53
54        /**
55          * Copy constructor.
56          *
57          * @param other The object to be copied.
58          */
59        DOM_NodeIterator(const DOM_NodeIterator &other);
60
61        /**
62          * Assignment operator.
63          *
64          * @param other The object to be copied.
65          */
66        DOM_NodeIterator & operator = (const DOM_NodeIterator &other);
67
68        /**
69          * Assignment operator.  This overloaded variant is provided for
70          *   the sole purpose of setting a DOM_NodeIterator to null.
71          *
72          * @param val   Only a value of 0, or null, is allowed.
73          */
74        DOM_NodeIterator & operator = (const DOM_NullPtr *val);
75        //@}
76
77        /** @name Destructor. */
78        //@{
79        /**
80          * Destructor for DOM_NodeIterator.
81          */
82        ~DOM_NodeIterator();
83        //@}
84
85        /** @name Equality and Inequality operators. */
86        //@{
87        /**
88         * The equality operator.
89         *
90         * @param other The object reference with which <code>this</code> object is compared
91         * @returns True if both <code>DOM_NodeIterator</code>s refer to the same
92         *  actual node, or are both null; return false otherwise.
93         */
94        bool operator == (const DOM_NodeIterator & other)const;
95
96        /**
97          *  Compare with a pointer.  Intended only to allow a convenient
98          *    comparison with null.
99          */
100        bool operator == (const DOM_NullPtr *other) const;
101
102        /**
103         * The inequality operator.  See operator ==.
104         */
105        bool operator != (const DOM_NodeIterator & other) const;
106
107         /**
108          *  Compare with a pointer.  Intended only to allow a convenient
109          *    comparison with null.
110          *
111          */
112        bool operator != (const DOM_NullPtr * other) const;
113        //@}
114
115        /** @name Get functions. */
116        //@{
117        /**
118         * The root node of the <code>NodeIterator</code>, as specified when it
119         * was created.
120         */
121        DOM_Node            getRoot();
122
123        /**
124          * Return which node types are presented via the iterator.
125          * The available set of constants is defined in the DOM_NodeFilter interface.
126          *
127          */
128        unsigned long       getWhatToShow();
129
130        /**
131          * Return The filter used to screen nodes.
132          *
133          */
134        DOM_NodeFilter*     getFilter();
135
136        /**
137          * Return the expandEntityReferences flag.
138          * The value of this flag determines whether the children of entity reference
139          * nodes are visible to the DOM_NodeFilter. If false, they will be skipped over.
140          *
141          */
142        bool getExpandEntityReferences();
143
144        /**
145          * Returns the next node in the set and advances the position of the iterator
146          * in the set. After a DOM_NodeIterator is created, the first call to nextNode()
147          * returns the first node in the set.
148          *
149          * @exception DOMException
150          *   INVALID_STATE_ERR: Raised if this method is called after the
151          *   <code>detach</code> method was invoked.
152          */
153        DOM_Node            nextNode();
154
155        /**
156          * Returns the previous node in the set and moves the position of the iterator
157          * backwards in the set.
158          *
159          * @exception DOMException
160          *   INVALID_STATE_ERR: Raised if this method is called after the
161          *   <code>detach</code> method was invoked.
162          */
163        DOM_Node            previousNode();
164        //@}
165
166        /** @name Detaching functions. */
167        //@{
168        /**
169          * Detaches the iterator from the set which it iterated over, releasing any
170          * computational resources and placing the iterator in the INVALID state. After
171          * <code>detach</code> has been invoked, calls to <code>nextNode</code> or
172          * <code>previousNode</code> will raise the exception INVALID_STATE_ERR.
173          *
174          */
175        void                            detach();
176        //@}
177
178    protected:
179        DOM_NodeIterator (NodeIteratorImpl* impl);
180
181        friend class DOM_Document;
182
183    private:
184        NodeIteratorImpl*                 fImpl;
185};
186
187XERCES_CPP_NAMESPACE_END
188
189#endif
Note: See TracBrowser for help on using the repository browser.