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

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