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

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

added xercesc to support

Line 
1#ifndef DOMNamedNodeMap_HEADER_GUARD_
2#define DOMNamedNodeMap_HEADER_GUARD_
3
4
5/*
6 * The Apache Software License, Version 1.1
7 *
8 * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
9 * reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 *
18 * 2. Redistributions in binary form must reproduce the above copyright
19 *    notice, this list of conditions and the following disclaimer in
20 *    the documentation and/or other materials provided with the
21 *    distribution.
22 *
23 * 3. The end-user documentation included with the redistribution,
24 *    if any, must include the following acknowledgment:
25 *       "This product includes software developed by the
26 *        Apache Software Foundation (http://www.apache.org/)."
27 *    Alternately, this acknowledgment may appear in the software itself,
28 *    if and wherever such third-party acknowledgments normally appear.
29 *
30 * 4. The names "Xerces" and "Apache Software Foundation" must
31 *    not be used to endorse or promote products derived from this
32 *    software without prior written permission. For written
33 *    permission, please contact apache\@apache.org.
34 *
35 * 5. Products derived from this software may not be called "Apache",
36 *    nor may "Apache" appear in their name, without prior written
37 *    permission of the Apache Software Foundation.
38 *
39 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
40 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
46 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
47 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
48 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
49 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This software consists of voluntary contributions made by many
54 * individuals on behalf of the Apache Software Foundation, and was
55 * originally based on software copyright (c) 2001, International
56 * Business Machines, Inc., http://www.ibm.com .  For more information
57 * on the Apache Software Foundation, please see
58 * <http://www.apache.org/>.
59 */
60
61/*
62 * $Id: DOMNamedNodeMap.hpp,v 1.8 2003/03/07 19:59:06 tng Exp $
63 */
64
65#include <xercesc/util/XercesDefs.hpp>
66
67XERCES_CPP_NAMESPACE_BEGIN
68
69
70class DOMNode;
71
72/**
73 *  <code>DOMNamedNodeMap</code>s  are used to
74 * represent collections of nodes that can be accessed by name.
75 *
76 * Note that <code>DOMNamedNodeMap</code> does not inherit from <code>DOMNodeList</code>;
77 * <code>DOMNamedNodeMap</code>s are not maintained in any particular order.
78 * Nodes contained in a <code>DOMNamedNodeMap</code> may
79 * also be accessed by an ordinal index, but this is simply to allow
80 * convenient enumeration of the contents, and
81 * does not imply that the DOM specifies an order to these Nodes.
82 *
83 * @since DOM Level 1
84 */
85class CDOM_EXPORT DOMNamedNodeMap {
86protected:
87    // -----------------------------------------------------------------------
88    //  Hidden constructors
89    // -----------------------------------------------------------------------
90    /** @name Hidden constructors */
91    //@{   
92    DOMNamedNodeMap() {};
93    //@}
94
95private:   
96    // -----------------------------------------------------------------------
97    // Unimplemented constructors and operators
98    // -----------------------------------------------------------------------
99    /** @name Unimplemented constructors and operators */
100    //@{
101    DOMNamedNodeMap(const DOMNamedNodeMap &);
102    DOMNamedNodeMap & operator = (const DOMNamedNodeMap &);
103    //@}
104
105public:
106    // -----------------------------------------------------------------------
107    //  All constructors are hidden, just the destructor is available
108    // -----------------------------------------------------------------------
109    /** @name Destructor */
110    //@{
111    /**
112     * Destructor
113     *
114     */
115    virtual ~DOMNamedNodeMap() {};
116    //@}
117
118    // -----------------------------------------------------------------------
119    //  Virtual DOMNamedNodeMap interface
120    // -----------------------------------------------------------------------
121    /** @name Functions introduced in DOM Level 1 */
122    //@{
123    // -----------------------------------------------------------------------
124    //  Setter methods
125    // -----------------------------------------------------------------------
126    /**
127     * Adds a node using its <code>nodeName</code> attribute.
128     *
129     * <br>As the <code>nodeName</code> attribute is used to derive the name
130     * which the node must be stored under, multiple nodes of certain types
131     * (those that have a "special" string value) cannot be stored as the names
132     * would clash. This is seen as preferable to allowing nodes to be aliased.
133     * @param arg A node to store in a named node map. The node will later be
134     *   accessible using the value of the <code>nodeName</code> attribute of
135     *   the node. If a node with that name is already present in the map, it
136     *   is replaced by the new one.
137     * @return If the new <code>DOMNode</code> replaces an existing node the
138     *   replaced <code>DOMNode</code> is returned,
139     *   otherwise <code>null</code> is returned.
140     * @exception DOMException
141     *   WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
142     *   different document than the one that created the
143     *   <code>DOMNamedNodeMap</code>.
144     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
145     *   <code>DOMNamedNodeMap</code> is readonly.
146     *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
147     *   <code>DOMAttr</code> that is already an attribute of another
148     *   <code>DOMElement</code> object. The DOM user must explicitly clone
149     *   <code>DOMAttr</code> nodes to re-use them in other elements.
150     * @since DOM Level 1
151     */
152    virtual DOMNode   *setNamedItem(DOMNode *arg) = 0;
153
154    // -----------------------------------------------------------------------
155    //  Getter methods
156    // -----------------------------------------------------------------------
157    /**
158     * Returns the <code>index</code>th item in the map.
159     *
160     * If <code>index</code>
161     * is greater than or equal to the number of nodes in the map, this returns
162     * <code>null</code>.
163     * @param index Index into the map.
164     * @return The node at the <code>index</code>th position in the
165     *   <code>DOMNamedNodeMap</code>, or <code>null</code> if that is not a valid
166     *   index.
167     * @since DOM Level 1
168     */
169    virtual DOMNode     *item(XMLSize_t index) const = 0;
170
171    /**
172     * Retrieves a node specified by name.
173     *
174     * @param name The <code>nodeName</code> of a node to retrieve.
175     * @return A <code>DOMNode</code> (of any type) with the specified <code>nodeName</code>, or
176     *   <code>null</code> if it does not identify any node in
177     *   the map.
178     * @since DOM Level 1
179     */
180    virtual DOMNode   *getNamedItem(const XMLCh *name) const = 0;
181
182    /**
183     * The number of nodes in the map.
184     *
185     * The range of valid child node indices is
186     * 0 to <code>length-1</code> inclusive.
187     * @since DOM Level 1
188     */
189    virtual XMLSize_t   getLength() const = 0;
190
191    // -----------------------------------------------------------------------
192    //  Node methods
193    // -----------------------------------------------------------------------
194    /**
195     * Removes a node specified by name.
196     *
197     * If the removed node is an
198     * <code>DOMAttr</code> with a default value it is immediately replaced.
199     * @param name The <code>nodeName</code> of a node to remove.
200     * @return The node removed from the map if a node with such a name exists.
201     * @exception DOMException
202     *   NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
203     *   the map.
204     * <br>
205     *   NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code>
206     *   is readonly.
207     * @since DOM Level 1
208     */
209    virtual DOMNode    *removeNamedItem(const XMLCh *name) = 0;
210    //@}
211
212    /** @name Functions introduced in DOM Level 2 */
213    //@{
214    /**
215     * Retrieves a node specified by local name and namespace URI.
216     *
217     * @param namespaceURI The <em>namespace URI</em> of
218     *    the node to retrieve.
219     * @param localName The <em>local name</em> of the node to retrieve.
220     * @return A <code>DOMNode</code> (of any type) with the specified
221     *    local name and namespace URI, or <code>null</code> if they do not
222     *    identify any node in the map.
223     * @since DOM Level 2
224     */
225    virtual DOMNode   *getNamedItemNS(const XMLCh *namespaceURI,
226                                                const XMLCh *localName) const = 0;
227
228    /**
229     * Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>.
230     *
231     * @param arg A node to store in a named node map. The node will later be
232     *       accessible using the value of the <CODE>namespaceURI</CODE> and
233     *       <CODE>localName</CODE> attribute of the node. If a node with those
234     *       namespace URI and local name is already present in the map, it is
235     *       replaced by the new one.
236     * @return If the new <code>DOMNode</code> replaces an existing node the
237     *   replaced <code>DOMNode</code> is returned,
238     *   otherwise <code>null</code> is returned.
239     * @exception DOMException
240     *   WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
241     *   different document than the one that created the
242     *   <code>DOMNamedNodeMap</code>.
243     *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
244     *   <code>DOMNamedNodeMap</code> is readonly.
245     *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
246     *   <code>DOMAttr</code> that is already an attribute of another
247     *   <code>DOMElement</code> object. The DOM user must explicitly clone
248     *   <code>DOMAttr</code> nodes to re-use them in other elements.
249     * @since DOM Level 2
250     */
251    virtual DOMNode   *setNamedItemNS(DOMNode *arg) = 0;
252
253    /**
254     * Removes a node specified by local name and namespace URI.
255     *
256     * @param namespaceURI The <em>namespace URI</em> of
257     *    the node to remove.
258     * @param localName The <em>local name</em> of the
259     *    node to remove. When this <code>DOMNamedNodeMap</code> contains the
260     *    attributes attached to an element, as returned by the attributes
261     *    attribute of the <code>DOMNode</code> interface, if the removed
262     *    attribute is known to have a default value, an attribute
263     *    immediately appears containing the default value
264     *    as well as the corresponding namespace URI, local name, and prefix.
265     * @return The node removed from the map if a node with such a local name
266     *    and namespace URI exists.
267     * @exception DOMException
268     *   NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
269     *   the map.
270     * <br>
271     *   NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code>
272     *   is readonly.
273     * @since DOM Level 2
274     */
275    virtual DOMNode     *removeNamedItemNS(const XMLCh *namespaceURI,
276                                                  const XMLCh *localName) = 0;
277    //@}
278
279};
280
281XERCES_CPP_NAMESPACE_END
282
283#endif
284
Note: See TracBrowser for help on using the repository browser.