/src/xerces-c/src/xercesc/dom/impl/DOMAttrMapImpl.hpp
Line | Count | Source (jump to first uncovered 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: DOMAttrMapImpl.hpp 678709 2008-07-22 10:56:56Z borisk $ |
20 | | */ |
21 | | |
22 | | #if !defined(XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP) |
23 | | #define XERCESC_INCLUDE_GUARD_DOMATTRMAPIMPL_HPP |
24 | | |
25 | | // |
26 | | // This file is part of the internal implementation of the C++ XML DOM. |
27 | | // It should NOT be included or used directly by application programs. |
28 | | // |
29 | | // Applications should include the file <xercesc/dom/DOM.hpp> for the entire |
30 | | // DOM API, or xercesc/dom/DOM*.hpp for individual DOM classes, where the class |
31 | | // name is substituded for the *. |
32 | | // |
33 | | |
34 | | #include <xercesc/util/XercesDefs.hpp> |
35 | | #include <xercesc/dom/DOMNamedNodeMap.hpp> |
36 | | |
37 | | XERCES_CPP_NAMESPACE_BEGIN |
38 | | |
39 | | class DOMNode; |
40 | | class DOMNodeVector; |
41 | | |
42 | | class CDOM_EXPORT DOMAttrMapImpl : public DOMNamedNodeMap |
43 | | { |
44 | | protected: |
45 | | DOMNodeVector* fNodes; |
46 | | DOMNode* fOwnerNode; // the node this map belongs to |
47 | | bool attrDefaults; |
48 | | |
49 | | virtual void cloneContent(const DOMAttrMapImpl *srcmap); |
50 | | |
51 | | bool readOnly(); // revisit. Look at owner node read-only. |
52 | | |
53 | | public: |
54 | | DOMAttrMapImpl(DOMNode *ownerNod); |
55 | | |
56 | | // revisit. This "copy" constructor is used for cloning an Element with Attributes, |
57 | | // and for setting up default attributes. It's probably not right |
58 | | // for one or the other or both. |
59 | | DOMAttrMapImpl(DOMNode *ownerNod, const DOMAttrMapImpl *defaults); |
60 | | DOMAttrMapImpl(); |
61 | | |
62 | | virtual ~DOMAttrMapImpl(); |
63 | | virtual DOMAttrMapImpl *cloneAttrMap(DOMNode *ownerNode); |
64 | | virtual bool hasDefaults(); |
65 | | virtual void hasDefaults(bool value); |
66 | | virtual int findNamePoint(const XMLCh *name) const; |
67 | | virtual int findNamePoint(const XMLCh *namespaceURI, |
68 | | const XMLCh *localName) const; |
69 | | virtual DOMNode* removeNamedItemAt(XMLSize_t index); |
70 | | virtual void setReadOnly(bool readOnly, bool deep); |
71 | | |
72 | | |
73 | | virtual XMLSize_t getLength() const; |
74 | | virtual DOMNode* item(XMLSize_t index) const; |
75 | | |
76 | | virtual DOMNode* getNamedItem(const XMLCh *name) const; |
77 | | virtual DOMNode* setNamedItem(DOMNode *arg); |
78 | | virtual DOMNode* removeNamedItem(const XMLCh *name); |
79 | | |
80 | | virtual DOMNode* getNamedItemNS(const XMLCh *namespaceURI, |
81 | | const XMLCh *localName) const; |
82 | | virtual DOMNode* setNamedItemNS(DOMNode *arg); |
83 | | virtual DOMNode* removeNamedItemNS(const XMLCh *namespaceURI, const XMLCh *localName); |
84 | | |
85 | | // Fast versions of the above functions which bypass validity checks. |
86 | | // It also assumes that fNode is not 0 (call reserve) and that there |
87 | | // is no previous node with this name. These are used in parsing. |
88 | | // |
89 | | void setNamedItemFast(DOMNode *arg); |
90 | | void setNamedItemNSFast(DOMNode *arg); |
91 | | |
92 | | // Tries to reserve space for the specified number of elements. |
93 | | // Currently only works on newly-created instances (fNodes == 0). |
94 | | // |
95 | | void reserve (XMLSize_t); |
96 | | |
97 | | void reconcileDefaultAttributes(const DOMAttrMapImpl* defaults); |
98 | | void moveSpecifiedAttributes(DOMAttrMapImpl* srcmap); |
99 | | |
100 | | private: |
101 | | // ----------------------------------------------------------------------- |
102 | | // Unimplemented constructors and operators |
103 | | // ----------------------------------------------------------------------- |
104 | | DOMAttrMapImpl(const DOMAttrMapImpl &); |
105 | | DOMAttrMapImpl & operator = (const DOMAttrMapImpl &); |
106 | | }; |
107 | | |
108 | | // --------------------------------------------------------------------------- |
109 | | // DOMAttrMapImpl: Getters & Setters |
110 | | // --------------------------------------------------------------------------- |
111 | | |
112 | | inline bool DOMAttrMapImpl::hasDefaults() |
113 | 0 | { |
114 | 0 | return attrDefaults; |
115 | 0 | } |
116 | | |
117 | | inline void DOMAttrMapImpl::hasDefaults(bool value) |
118 | 0 | { |
119 | 0 | attrDefaults = value; |
120 | 0 | } |
121 | | |
122 | | XERCES_CPP_NAMESPACE_END |
123 | | |
124 | | |
125 | | #endif |