source: NonGTP/Xerces/xercesc/dom/deprecated/DOM_NodeList.hpp @ 188

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

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57/*
58 * $Id: DOM_NodeList.hpp,v 1.3 2002/11/04 15:04:44 tng Exp $
59 */
60
61#ifndef DOM_NodeList_HEADER_GUARD_
62#define DOM_NodeList_HEADER_GUARD_
63
64#include <xercesc/util/XercesDefs.hpp>
65#include "DOM_Node.hpp"
66
67XERCES_CPP_NAMESPACE_BEGIN
68
69
70class NodeListImpl;
71
72/**
73 * The <code>NodeList</code> interface provides the abstraction of an ordered
74 * collection of nodes.  NodeLists are created by DOM_Document::getElementsByTagName(),
75 * DOM_Node::getChildNodes(),
76 *
77 * <p>The items in the <code>NodeList</code> are accessible via an integral
78 * index, starting from 0.
79 *
80 * NodeLists are "live", in that any changes to the document tree are immediately
81 * reflected in any NodeLists that may have been created for that tree.
82 */
83
84class  CDOM_EXPORT DOM_NodeList {
85private:
86    NodeListImpl *fImpl;
87
88public:
89    /** @name Constructors and assignment operator */
90    //@{
91    /**
92      * Default constructor for DOM_NodeList.  The resulting object does not
93      * refer to an actual NodeList; it will compare == to 0, and is similar
94      * to a null object reference variable in Java.  It may subsequently be
95      * assigned to refer to an actual NodeList.
96      *
97      */
98    DOM_NodeList();
99
100    /**
101      * Copy constructor.
102      *
103      * @param other The object to be copied.
104      */
105    DOM_NodeList(const DOM_NodeList &other);
106
107    /**
108      * Assignment operator.
109      *
110      * @param other The object to be copied.
111      */
112    DOM_NodeList & operator = (const DOM_NodeList &other);
113
114    /**
115      * Assignment operator.  This overloaded variant is provided for
116      *   the sole purpose of setting a DOM_Node reference variable to
117      *   zero.  Nulling out a reference variable in this way will decrement
118      *   the reference count on the underlying Node object that the variable
119      *   formerly referenced.  This effect is normally obtained when reference
120      *   variable goes out of scope, but zeroing them can be useful for
121      *   global instances, or for local instances that will remain in scope
122      *   for an extended time,  when the storage belonging to the underlying
123      *   node needs to be reclaimed.
124      *
125      * @param val   Only a value of 0, or null, is allowed.
126      */
127    DOM_NodeList & operator = (const DOM_NullPtr *val);
128
129    //@}
130    /** @name Destructor. */
131    //@{
132         /**
133          * Destructor for DOM_NodeList.  The object being destroyed is the reference
134      * object, not the underlying NodeList node itself.
135          *
136      * <p>Like most other DOM types in this implementation, memory management
137      * of Node Lists is automatic.  Instances of DOM_NodeList function
138      * as references to an underlying heap based implementation object,
139      * and should never be explicitly new-ed or deleted in application code, but
140      * should appear only as local variables or function parameters.
141          */
142    ~DOM_NodeList();
143    //@}
144
145    /** @name Comparison operators. */
146    //@{
147
148    /**
149      *  Equality operator.
150      *  Compares whether two node list
151      *  variables refer to the same underlying node list.  It does
152      *  not compare the contents of the node lists themselves.
153      *
154      *  @param other The value to be compared
155      *  @return Returns true if node list refers to same underlying node list
156      */
157    bool operator == (const DOM_NodeList &other) const;
158
159    /**
160     *  Use this comparison operator to test whether a Node List reference
161     *  is null.
162     *
163     *  @param nullPtr The value to be compared, which must be 0 or null.
164     *  @return Returns true if node list reference is null
165     */
166    bool operator == (const DOM_NullPtr *nullPtr) const;
167
168     /**
169      *  Inequality operator.
170      *  Compares whether two node list
171      *  variables refer to the same underlying node list.  It does
172      *  not compare the contents of the node lists themselves.
173      *
174      *  @param other The value to be compared
175      *  @return Returns true if node list refers to a different underlying node list
176      */
177    bool operator != (const DOM_NodeList &other) const;
178
179    /**
180     *  Use this comparison operator to test whether a Node List reference
181     *  is not null.
182     *
183     *  @param nullPtr The value to be compared, which must be 0 or null.
184     *  @return Returns true if node list reference is not null
185     */
186    bool operator != (const DOM_NullPtr *nullPtr) const;
187    //@}
188
189
190    /** @name Get functions. */
191    //@{
192    /**
193     * Returns the <code>index</code>th item in the collection.
194     *
195     * If <code>index</code> is greater than or equal to the number of nodes in
196     * the list, this returns <code>null</code>.
197     *
198     * @param index Index into the collection.
199     * @return The node at the <code>index</code>th position in the
200     *   <code>NodeList</code>, or <code>null</code> if that is not a valid
201     *   index.
202     */
203    DOM_Node  item(unsigned int index) const;
204
205    /**
206     * Returns the number of nodes in the list.
207     *
208     * The range of valid child node indices is 0 to <code>length-1</code> inclusive.
209     */
210    unsigned int getLength() const;
211    //@}
212
213protected:
214    DOM_NodeList(NodeListImpl *impl);
215
216    friend class DOM_Document;
217    friend class DOM_Element;
218    friend class DOM_Node;
219    friend class DOM_Entity;
220
221};
222
223XERCES_CPP_NAMESPACE_END
224
225#endif
226
227
Note: See TracBrowser for help on using the repository browser.