[2674] | 1 | #ifndef DOMNamedNodeMap_HEADER_GUARD_ |
---|
| 2 | #define DOMNamedNodeMap_HEADER_GUARD_ |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | /* |
---|
| 6 | * Licensed to the Apache Software Foundation (ASF) under one or more |
---|
| 7 | * contributor license agreements. See the NOTICE file distributed with |
---|
| 8 | * this work for additional information regarding copyright ownership. |
---|
| 9 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
| 10 | * (the "License"); you may not use this file except in compliance with |
---|
| 11 | * the License. You may obtain a copy of the License at |
---|
| 12 | * |
---|
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 14 | * |
---|
| 15 | * Unless required by applicable law or agreed to in writing, software |
---|
| 16 | * distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 18 | * See the License for the specific language governing permissions and |
---|
| 19 | * limitations under the License. |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | /* |
---|
| 23 | * $Id: DOMNamedNodeMap.hpp 568078 2007-08-21 11:43:25Z amassari $ |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | #include <xercesc/util/XercesDefs.hpp> |
---|
| 27 | |
---|
| 28 | XERCES_CPP_NAMESPACE_BEGIN |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | class DOMNode; |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * <code>DOMNamedNodeMap</code>s are used to |
---|
| 35 | * represent collections of nodes that can be accessed by name. |
---|
| 36 | * |
---|
| 37 | * Note that <code>DOMNamedNodeMap</code> does not inherit from <code>DOMNodeList</code>; |
---|
| 38 | * <code>DOMNamedNodeMap</code>s are not maintained in any particular order. |
---|
| 39 | * Nodes contained in a <code>DOMNamedNodeMap</code> may |
---|
| 40 | * also be accessed by an ordinal index, but this is simply to allow |
---|
| 41 | * convenient enumeration of the contents, and |
---|
| 42 | * does not imply that the DOM specifies an order to these Nodes. |
---|
| 43 | * |
---|
| 44 | * @since DOM Level 1 |
---|
| 45 | */ |
---|
| 46 | class CDOM_EXPORT DOMNamedNodeMap { |
---|
| 47 | protected: |
---|
| 48 | // ----------------------------------------------------------------------- |
---|
| 49 | // Hidden constructors |
---|
| 50 | // ----------------------------------------------------------------------- |
---|
| 51 | /** @name Hidden constructors */ |
---|
| 52 | //@{ |
---|
| 53 | DOMNamedNodeMap() {}; |
---|
| 54 | //@} |
---|
| 55 | |
---|
| 56 | private: |
---|
| 57 | // ----------------------------------------------------------------------- |
---|
| 58 | // Unimplemented constructors and operators |
---|
| 59 | // ----------------------------------------------------------------------- |
---|
| 60 | /** @name Unimplemented constructors and operators */ |
---|
| 61 | //@{ |
---|
| 62 | DOMNamedNodeMap(const DOMNamedNodeMap &); |
---|
| 63 | DOMNamedNodeMap & operator = (const DOMNamedNodeMap &); |
---|
| 64 | //@} |
---|
| 65 | |
---|
| 66 | public: |
---|
| 67 | // ----------------------------------------------------------------------- |
---|
| 68 | // All constructors are hidden, just the destructor is available |
---|
| 69 | // ----------------------------------------------------------------------- |
---|
| 70 | /** @name Destructor */ |
---|
| 71 | //@{ |
---|
| 72 | /** |
---|
| 73 | * Destructor |
---|
| 74 | * |
---|
| 75 | */ |
---|
| 76 | virtual ~DOMNamedNodeMap() {}; |
---|
| 77 | //@} |
---|
| 78 | |
---|
| 79 | // ----------------------------------------------------------------------- |
---|
| 80 | // Virtual DOMNamedNodeMap interface |
---|
| 81 | // ----------------------------------------------------------------------- |
---|
| 82 | /** @name Functions introduced in DOM Level 1 */ |
---|
| 83 | //@{ |
---|
| 84 | // ----------------------------------------------------------------------- |
---|
| 85 | // Setter methods |
---|
| 86 | // ----------------------------------------------------------------------- |
---|
| 87 | /** |
---|
| 88 | * Adds a node using its <code>nodeName</code> attribute. |
---|
| 89 | * |
---|
| 90 | * <br>As the <code>nodeName</code> attribute is used to derive the name |
---|
| 91 | * which the node must be stored under, multiple nodes of certain types |
---|
| 92 | * (those that have a "special" string value) cannot be stored as the names |
---|
| 93 | * would clash. This is seen as preferable to allowing nodes to be aliased. |
---|
| 94 | * @param arg A node to store in a named node map. The node will later be |
---|
| 95 | * accessible using the value of the <code>nodeName</code> attribute of |
---|
| 96 | * the node. If a node with that name is already present in the map, it |
---|
| 97 | * is replaced by the new one. |
---|
| 98 | * @return If the new <code>DOMNode</code> replaces an existing node the |
---|
| 99 | * replaced <code>DOMNode</code> is returned, |
---|
| 100 | * otherwise <code>null</code> is returned. |
---|
| 101 | * @exception DOMException |
---|
| 102 | * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a |
---|
| 103 | * different document than the one that created the |
---|
| 104 | * <code>DOMNamedNodeMap</code>. |
---|
| 105 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this |
---|
| 106 | * <code>DOMNamedNodeMap</code> is readonly. |
---|
| 107 | * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an |
---|
| 108 | * <code>DOMAttr</code> that is already an attribute of another |
---|
| 109 | * <code>DOMElement</code> object. The DOM user must explicitly clone |
---|
| 110 | * <code>DOMAttr</code> nodes to re-use them in other elements. |
---|
| 111 | * @since DOM Level 1 |
---|
| 112 | */ |
---|
| 113 | virtual DOMNode *setNamedItem(DOMNode *arg) = 0; |
---|
| 114 | |
---|
| 115 | // ----------------------------------------------------------------------- |
---|
| 116 | // Getter methods |
---|
| 117 | // ----------------------------------------------------------------------- |
---|
| 118 | /** |
---|
| 119 | * Returns the <code>index</code>th item in the map. |
---|
| 120 | * |
---|
| 121 | * If <code>index</code> |
---|
| 122 | * is greater than or equal to the number of nodes in the map, this returns |
---|
| 123 | * <code>null</code>. |
---|
| 124 | * @param index Index into the map. |
---|
| 125 | * @return The node at the <code>index</code>th position in the |
---|
| 126 | * <code>DOMNamedNodeMap</code>, or <code>null</code> if that is not a valid |
---|
| 127 | * index. |
---|
| 128 | * @since DOM Level 1 |
---|
| 129 | */ |
---|
| 130 | virtual DOMNode *item(XMLSize_t index) const = 0; |
---|
| 131 | |
---|
| 132 | /** |
---|
| 133 | * Retrieves a node specified by name. |
---|
| 134 | * |
---|
| 135 | * @param name The <code>nodeName</code> of a node to retrieve. |
---|
| 136 | * @return A <code>DOMNode</code> (of any type) with the specified <code>nodeName</code>, or |
---|
| 137 | * <code>null</code> if it does not identify any node in |
---|
| 138 | * the map. |
---|
| 139 | * @since DOM Level 1 |
---|
| 140 | */ |
---|
| 141 | virtual DOMNode *getNamedItem(const XMLCh *name) const = 0; |
---|
| 142 | |
---|
| 143 | /** |
---|
| 144 | * The number of nodes in the map. |
---|
| 145 | * |
---|
| 146 | * The range of valid child node indices is |
---|
| 147 | * 0 to <code>length-1</code> inclusive. |
---|
| 148 | * @since DOM Level 1 |
---|
| 149 | */ |
---|
| 150 | virtual XMLSize_t getLength() const = 0; |
---|
| 151 | |
---|
| 152 | // ----------------------------------------------------------------------- |
---|
| 153 | // Node methods |
---|
| 154 | // ----------------------------------------------------------------------- |
---|
| 155 | /** |
---|
| 156 | * Removes a node specified by name. |
---|
| 157 | * |
---|
| 158 | * If the removed node is an |
---|
| 159 | * <code>DOMAttr</code> with a default value it is immediately replaced. |
---|
| 160 | * @param name The <code>nodeName</code> of a node to remove. |
---|
| 161 | * @return The node removed from the map if a node with such a name exists. |
---|
| 162 | * @exception DOMException |
---|
| 163 | * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in |
---|
| 164 | * the map. |
---|
| 165 | * <br> |
---|
| 166 | * NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code> |
---|
| 167 | * is readonly. |
---|
| 168 | * @since DOM Level 1 |
---|
| 169 | */ |
---|
| 170 | virtual DOMNode *removeNamedItem(const XMLCh *name) = 0; |
---|
| 171 | //@} |
---|
| 172 | |
---|
| 173 | /** @name Functions introduced in DOM Level 2 */ |
---|
| 174 | //@{ |
---|
| 175 | /** |
---|
| 176 | * Retrieves a node specified by local name and namespace URI. |
---|
| 177 | * |
---|
| 178 | * @param namespaceURI The <em>namespace URI</em> of |
---|
| 179 | * the node to retrieve. |
---|
| 180 | * @param localName The <em>local name</em> of the node to retrieve. |
---|
| 181 | * @return A <code>DOMNode</code> (of any type) with the specified |
---|
| 182 | * local name and namespace URI, or <code>null</code> if they do not |
---|
| 183 | * identify any node in the map. |
---|
| 184 | * @since DOM Level 2 |
---|
| 185 | */ |
---|
| 186 | virtual DOMNode *getNamedItemNS(const XMLCh *namespaceURI, |
---|
| 187 | const XMLCh *localName) const = 0; |
---|
| 188 | |
---|
| 189 | /** |
---|
| 190 | * Adds a node using its <CODE>namespaceURI</CODE> and <CODE>localName</CODE>. |
---|
| 191 | * |
---|
| 192 | * @param arg A node to store in a named node map. The node will later be |
---|
| 193 | * accessible using the value of the <CODE>namespaceURI</CODE> and |
---|
| 194 | * <CODE>localName</CODE> attribute of the node. If a node with those |
---|
| 195 | * namespace URI and local name is already present in the map, it is |
---|
| 196 | * replaced by the new one. |
---|
| 197 | * @return If the new <code>DOMNode</code> replaces an existing node the |
---|
| 198 | * replaced <code>DOMNode</code> is returned, |
---|
| 199 | * otherwise <code>null</code> is returned. |
---|
| 200 | * @exception DOMException |
---|
| 201 | * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a |
---|
| 202 | * different document than the one that created the |
---|
| 203 | * <code>DOMNamedNodeMap</code>. |
---|
| 204 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this |
---|
| 205 | * <code>DOMNamedNodeMap</code> is readonly. |
---|
| 206 | * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an |
---|
| 207 | * <code>DOMAttr</code> that is already an attribute of another |
---|
| 208 | * <code>DOMElement</code> object. The DOM user must explicitly clone |
---|
| 209 | * <code>DOMAttr</code> nodes to re-use them in other elements. |
---|
| 210 | * @since DOM Level 2 |
---|
| 211 | */ |
---|
| 212 | virtual DOMNode *setNamedItemNS(DOMNode *arg) = 0; |
---|
| 213 | |
---|
| 214 | /** |
---|
| 215 | * Removes a node specified by local name and namespace URI. |
---|
| 216 | * |
---|
| 217 | * @param namespaceURI The <em>namespace URI</em> of |
---|
| 218 | * the node to remove. |
---|
| 219 | * @param localName The <em>local name</em> of the |
---|
| 220 | * node to remove. When this <code>DOMNamedNodeMap</code> contains the |
---|
| 221 | * attributes attached to an element, as returned by the attributes |
---|
| 222 | * attribute of the <code>DOMNode</code> interface, if the removed |
---|
| 223 | * attribute is known to have a default value, an attribute |
---|
| 224 | * immediately appears containing the default value |
---|
| 225 | * as well as the corresponding namespace URI, local name, and prefix. |
---|
| 226 | * @return The node removed from the map if a node with such a local name |
---|
| 227 | * and namespace URI exists. |
---|
| 228 | * @exception DOMException |
---|
| 229 | * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in |
---|
| 230 | * the map. |
---|
| 231 | * <br> |
---|
| 232 | * NO_MODIFICATION_ALLOWED_ERR: Raised if this <code>DOMNamedNodeMap</code> |
---|
| 233 | * is readonly. |
---|
| 234 | * @since DOM Level 2 |
---|
| 235 | */ |
---|
| 236 | virtual DOMNode *removeNamedItemNS(const XMLCh *namespaceURI, |
---|
| 237 | const XMLCh *localName) = 0; |
---|
| 238 | //@} |
---|
| 239 | |
---|
| 240 | }; |
---|
| 241 | |
---|
| 242 | #define GetDOMNamedNodeMapMemoryManager GET_INDIRECT_MM(fOwnerNode) |
---|
| 243 | |
---|
| 244 | XERCES_CPP_NAMESPACE_END |
---|
| 245 | |
---|
| 246 | #endif |
---|
| 247 | |
---|