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

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

xerces added

Line 
1/*
2 * Copyright 1999-2002,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Id: DOM_NodeList.hpp,v 1.5 2004/09/08 13:55:42 peiyongz Exp $
19 */
20
21#ifndef DOM_NodeList_HEADER_GUARD_
22#define DOM_NodeList_HEADER_GUARD_
23
24#include <xercesc/util/XercesDefs.hpp>
25#include "DOM_Node.hpp"
26
27XERCES_CPP_NAMESPACE_BEGIN
28
29
30class NodeListImpl;
31
32/**
33 * The <code>NodeList</code> interface provides the abstraction of an ordered
34 * collection of nodes.  NodeLists are created by DOM_Document::getElementsByTagName(),
35 * DOM_Node::getChildNodes(),
36 *
37 * <p>The items in the <code>NodeList</code> are accessible via an integral
38 * index, starting from 0.
39 *
40 * NodeLists are "live", in that any changes to the document tree are immediately
41 * reflected in any NodeLists that may have been created for that tree.
42 */
43
44class  DEPRECATED_DOM_EXPORT DOM_NodeList {
45private:
46    NodeListImpl *fImpl;
47
48public:
49    /** @name Constructors and assignment operator */
50    //@{
51    /**
52      * Default constructor for DOM_NodeList.  The resulting object does not
53      * refer to an actual NodeList; it will compare == to 0, and is similar
54      * to a null object reference variable in Java.  It may subsequently be
55      * assigned to refer to an actual NodeList.
56      *
57      */
58    DOM_NodeList();
59
60    /**
61      * Copy constructor.
62      *
63      * @param other The object to be copied.
64      */
65    DOM_NodeList(const DOM_NodeList &other);
66
67    /**
68      * Assignment operator.
69      *
70      * @param other The object to be copied.
71      */
72    DOM_NodeList & operator = (const DOM_NodeList &other);
73
74    /**
75      * Assignment operator.  This overloaded variant is provided for
76      *   the sole purpose of setting a DOM_Node reference variable to
77      *   zero.  Nulling out a reference variable in this way will decrement
78      *   the reference count on the underlying Node object that the variable
79      *   formerly referenced.  This effect is normally obtained when reference
80      *   variable goes out of scope, but zeroing them can be useful for
81      *   global instances, or for local instances that will remain in scope
82      *   for an extended time,  when the storage belonging to the underlying
83      *   node needs to be reclaimed.
84      *
85      * @param val   Only a value of 0, or null, is allowed.
86      */
87    DOM_NodeList & operator = (const DOM_NullPtr *val);
88
89    //@}
90    /** @name Destructor. */
91    //@{
92         /**
93          * Destructor for DOM_NodeList.  The object being destroyed is the reference
94      * object, not the underlying NodeList node itself.
95          *
96      * <p>Like most other DOM types in this implementation, memory management
97      * of Node Lists is automatic.  Instances of DOM_NodeList function
98      * as references to an underlying heap based implementation object,
99      * and should never be explicitly new-ed or deleted in application code, but
100      * should appear only as local variables or function parameters.
101          */
102    ~DOM_NodeList();
103    //@}
104
105    /** @name Comparison operators. */
106    //@{
107
108    /**
109      *  Equality operator.
110      *  Compares whether two node list
111      *  variables refer to the same underlying node list.  It does
112      *  not compare the contents of the node lists themselves.
113      *
114      *  @param other The value to be compared
115      *  @return Returns true if node list refers to same underlying node list
116      */
117    bool operator == (const DOM_NodeList &other) const;
118
119    /**
120     *  Use this comparison operator to test whether a Node List reference
121     *  is null.
122     *
123     *  @param nullPtr The value to be compared, which must be 0 or null.
124     *  @return Returns true if node list reference is null
125     */
126    bool operator == (const DOM_NullPtr *nullPtr) const;
127
128     /**
129      *  Inequality operator.
130      *  Compares whether two node list
131      *  variables refer to the same underlying node list.  It does
132      *  not compare the contents of the node lists themselves.
133      *
134      *  @param other The value to be compared
135      *  @return Returns true if node list refers to a different underlying node list
136      */
137    bool operator != (const DOM_NodeList &other) const;
138
139    /**
140     *  Use this comparison operator to test whether a Node List reference
141     *  is not null.
142     *
143     *  @param nullPtr The value to be compared, which must be 0 or null.
144     *  @return Returns true if node list reference is not null
145     */
146    bool operator != (const DOM_NullPtr *nullPtr) const;
147    //@}
148
149
150    /** @name Get functions. */
151    //@{
152    /**
153     * Returns the <code>index</code>th item in the collection.
154     *
155     * If <code>index</code> is greater than or equal to the number of nodes in
156     * the list, this returns <code>null</code>.
157     *
158     * @param index Index into the collection.
159     * @return The node at the <code>index</code>th position in the
160     *   <code>NodeList</code>, or <code>null</code> if that is not a valid
161     *   index.
162     */
163    DOM_Node  item(unsigned int index) const;
164
165    /**
166     * Returns the number of nodes in the list.
167     *
168     * The range of valid child node indices is 0 to <code>length-1</code> inclusive.
169     */
170    unsigned int getLength() const;
171    //@}
172
173protected:
174    DOM_NodeList(NodeListImpl *impl);
175
176    friend class DOM_Document;
177    friend class DOM_Element;
178    friend class DOM_Node;
179    friend class DOM_Entity;
180
181};
182
183XERCES_CPP_NAMESPACE_END
184
185#endif
186
187
Note: See TracBrowser for help on using the repository browser.