Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:51

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMNAMEDNODEMAP_HPP
0024 
0025 #include <xercesc/util/XercesDefs.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 
0030 class DOMNode;
0031 
0032 /**
0033  *  <code>DOMNamedNodeMap</code>s  are used to
0034  * represent collections of nodes that can be accessed by name.
0035  *
0036  * Note that <code>DOMNamedNodeMap</code> does not inherit from <code>DOMNodeList</code>;
0037  * <code>DOMNamedNodeMap</code>s are not maintained in any particular order.
0038  * Nodes contained in a <code>DOMNamedNodeMap</code> may
0039  * also be accessed by an ordinal index, but this is simply to allow
0040  * convenient enumeration of the contents, and
0041  * does not imply that the DOM specifies an order to these Nodes.
0042  *
0043  * @since DOM Level 1
0044  */
0045 class CDOM_EXPORT DOMNamedNodeMap {
0046 protected:
0047     // -----------------------------------------------------------------------
0048     //  Hidden constructors
0049     // -----------------------------------------------------------------------
0050     /** @name Hidden constructors */
0051     //@{
0052     DOMNamedNodeMap() {};
0053     //@}
0054 
0055 private:
0056     // -----------------------------------------------------------------------
0057     // Unimplemented constructors and operators
0058     // -----------------------------------------------------------------------
0059     /** @name Unimplemented constructors and operators */
0060     //@{
0061     DOMNamedNodeMap(const DOMNamedNodeMap &);
0062     DOMNamedNodeMap & operator = (const DOMNamedNodeMap &);
0063     //@}
0064 
0065 public:
0066     // -----------------------------------------------------------------------
0067     //  All constructors are hidden, just the destructor is available
0068     // -----------------------------------------------------------------------
0069     /** @name Destructor */
0070     //@{
0071     /**
0072      * Destructor
0073      *
0074      */
0075     virtual ~DOMNamedNodeMap() {};
0076     //@}
0077 
0078     // -----------------------------------------------------------------------
0079     //  Virtual DOMNamedNodeMap interface
0080     // -----------------------------------------------------------------------
0081     /** @name Functions introduced in DOM Level 1 */
0082     //@{
0083     // -----------------------------------------------------------------------
0084     //  Setter methods
0085     // -----------------------------------------------------------------------
0086     /**
0087      * Adds a node using its <code>nodeName</code> attribute.
0088      *
0089      * <br>As the <code>nodeName</code> attribute is used to derive the name
0090      * which the node must be stored under, multiple nodes of certain types
0091      * (those that have a "special" string value) cannot be stored as the names
0092      * would clash. This is seen as preferable to allowing nodes to be aliased.
0093      * @param arg A node to store in a named node map. The node will later be
0094      *   accessible using the value of the <code>nodeName</code> attribute of
0095      *   the node. If a node with that name is already present in the map, it
0096      *   is replaced by the new one.
0097      * @return If the new <code>DOMNode</code> replaces an existing node the
0098      *   replaced <code>DOMNode</code> is returned,
0099      *   otherwise <code>null</code> is returned.
0100      * @exception DOMException
0101      *   WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
0102      *   different document than the one that created the
0103      *   <code>DOMNamedNodeMap</code>.
0104      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
0105      *   <code>DOMNamedNodeMap</code> is readonly.
0106      *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
0107      *   <code>DOMAttr</code> that is already an attribute of another
0108      *   <code>DOMElement</code> object. The DOM user must explicitly clone
0109      *   <code>DOMAttr</code> nodes to re-use them in other elements.
0110      * @since DOM Level 1
0111      */
0112     virtual DOMNode   *setNamedItem(DOMNode *arg) = 0;
0113 
0114     // -----------------------------------------------------------------------
0115     //  Getter methods
0116     // -----------------------------------------------------------------------
0117     /**
0118      * Returns the <code>index</code>th item in the map.
0119      *
0120      * If <code>index</code>
0121      * is greater than or equal to the number of nodes in the map, this returns
0122      * <code>null</code>.
0123      * @param index Index into the map.
0124      * @return The node at the <code>index</code>th position in the
0125      *   <code>DOMNamedNodeMap</code>, or <code>null</code> if that is not a valid
0126      *   index.
0127      * @since DOM Level 1
0128      */
0129     virtual DOMNode     *item(XMLSize_t index) const = 0;
0130 
0131     /**
0132      * Retrieves a node specified by name.
0133      *
0134      * @param name The <code>nodeName</code> of a node to retrieve.
0135      * @return A <code>DOMNode</code> (of any type) with the specified <code>nodeName</code>, or
0136      *   <code>null</code> if it does not identify any node in
0137      *   the map.
0138      * @since DOM Level 1
0139      */
0140     virtual DOMNode   *getNamedItem(const XMLCh *name) const = 0;
0141 
0142     /**
0143      * The number of nodes in the map.
0144      *
0145      * The range of valid child node indices is
0146      * 0 to <code>length-1</code> inclusive.
0147      * @since DOM Level 1
0148      */
0149     virtual XMLSize_t getLength() const = 0;
0150 
0151     // -----------------------------------------------------------------------
0152     //  Node methods
0153     // -----------------------------------------------------------------------
0154     /**
0155      * Removes a node specified by name.
0156      *
0157      * If the removed node is an
0158      * <code>DOMAttr</code> with a default value it is immediately replaced.
0159      * @param name The <code>nodeName</code> of a node to remove.
0160      * @return The node removed from the map if a node with such a name exists.
0161      * @exception DOMException
0162      *   NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
0163      *   the map.
0164      * <br>
0165      *   NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code>
0166      *   is readonly.
0167      * @since DOM Level 1
0168      */
0169     virtual DOMNode    *removeNamedItem(const XMLCh *name) = 0;
0170     //@}
0171 
0172     /** @name Functions introduced in DOM Level 2 */
0173     //@{
0174     /**
0175      * Retrieves a node specified by local name and namespace URI.
0176      *
0177      * @param namespaceURI The <em>namespace URI</em> of
0178      *    the node to retrieve.
0179      * @param localName The <em>local name</em> of the node to retrieve.
0180      * @return A <code>DOMNode</code> (of any type) with the specified
0181      *    local name and namespace URI, or <code>null</code> if they do not
0182      *    identify any node in the map.
0183      * @since DOM Level 2
0184      */
0185     virtual DOMNode   *getNamedItemNS(const XMLCh *namespaceURI,
0186                                       const XMLCh *localName) const = 0;
0187 
0188     /**
0189      * Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>.
0190      *
0191      * @param arg A node to store in a named node map. The node will later be
0192      *       accessible using the value of the <CODE>namespaceURI</CODE> and
0193      *       <CODE>localName</CODE> attribute of the node. If a node with those
0194      *       namespace URI and local name is already present in the map, it is
0195      *       replaced by the new one.
0196      * @return If the new <code>DOMNode</code> replaces an existing node the
0197      *   replaced <code>DOMNode</code> is returned,
0198      *   otherwise <code>null</code> is returned.
0199      * @exception DOMException
0200      *   WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
0201      *   different document than the one that created the
0202      *   <code>DOMNamedNodeMap</code>.
0203      *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this
0204      *   <code>DOMNamedNodeMap</code> is readonly.
0205      *   <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
0206      *   <code>DOMAttr</code> that is already an attribute of another
0207      *   <code>DOMElement</code> object. The DOM user must explicitly clone
0208      *   <code>DOMAttr</code> nodes to re-use them in other elements.
0209      * @since DOM Level 2
0210      */
0211     virtual DOMNode   *setNamedItemNS(DOMNode *arg) = 0;
0212 
0213     /**
0214      * Removes a node specified by local name and namespace URI.
0215      *
0216      * @param namespaceURI The <em>namespace URI</em> of
0217      *    the node to remove.
0218      * @param localName The <em>local name</em> of the
0219      *    node to remove. When this <code>DOMNamedNodeMap</code> contains the
0220      *    attributes attached to an element, as returned by the attributes
0221      *    attribute of the <code>DOMNode</code> interface, if the removed
0222      *    attribute is known to have a default value, an attribute
0223      *    immediately appears containing the default value
0224      *    as well as the corresponding namespace URI, local name, and prefix.
0225      * @return The node removed from the map if a node with such a local name
0226      *    and namespace URI exists.
0227      * @exception DOMException
0228      *   NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
0229      *   the map.
0230      * <br>
0231      *   NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code>
0232      *   is readonly.
0233      * @since DOM Level 2
0234      */
0235     virtual DOMNode     *removeNamedItemNS(const XMLCh *namespaceURI,
0236                                            const XMLCh *localName) = 0;
0237     //@}
0238 
0239 };
0240 
0241 #define GetDOMNamedNodeMapMemoryManager   GET_INDIRECT_MM(fOwnerNode)
0242 
0243 XERCES_CPP_NAMESPACE_END
0244 
0245 #endif