Xalan-C++ API Reference 1.12.0
AttributesImpl.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(ATTRIBUTESIMPL_HEADER_GUARD_1357924680)
19#define ATTRIBUTESIMPL_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
29
30
31
32#include <xercesc/sax2/Attributes.hpp>
33
34
35
36namespace XALAN_CPP_NAMESPACE {
37
38
39
40class AttributeVectorEntryExtended;
41
42
43
44typedef xercesc::Attributes AttributesType;
45
46
47
49{
50public:
51
52 explicit
54
55 virtual
57
59 MemoryManager& theManager);
60
62 MemoryManager& theManager);
63
66
69
70 // These are inherited from Attributes
71 virtual XalanSize_t
72 getLength() const;
73
74 virtual const XMLCh*
75 getURI(const XalanSize_t index) const;
76
77 virtual const XMLCh*
78 getLocalName(const XalanSize_t index) const;
79
80 virtual const XMLCh*
81 getQName(const XalanSize_t index) const;
82
83 virtual const XMLCh*
84 getType(const XalanSize_t index) const;
85
86 virtual const XMLCh*
87 getValue(const XalanSize_t index) const;
88
89 virtual bool
91 const XMLCh* const uri,
92 const XMLCh* const localPart,
93 XalanSize_t& index) const;
94
95 virtual int
97 const XMLCh* const uri,
98 const XMLCh* const localPart) const;
99
100 virtual bool
102 const XMLCh* const qName,
103 XalanSize_t& index) const;
104
105 virtual int
106 getIndex(const XMLCh* const qname) const;
107
108 virtual const XMLCh*
109 getType(const XMLCh* const qname) const;
110
111 virtual const XMLCh*
113 const XMLCh* const uri,
114 const XMLCh* const localName) const;
115
116 virtual const XMLCh*
117 getValue(const XMLCh* const qname) const;
118
119 virtual const XMLCh*
121 const XMLCh* const uri,
122 const XMLCh* const localName) const;
123
124 MemoryManager&
126 {
127 return m_attributesVector.getMemoryManager();
128 }
129
130 // The mutators are new to this class.
131
132 /**
133 * Remove all attributes from the list
134 */
135 virtual void
137
138 /**
139 * Adds an attribute to the attribute list. Does not check for
140 * duplicates.
141 *
142 * @param qname attribute qname
143 * @param type attribute type, "CDATA," for example
144 * @param value attribute value
145 */
146 void
148 const XMLCh* qname,
149 const XMLCh* type,
150 const XMLCh* value)
151 {
152 const XMLCh theDummy = 0;
153
154 addAttribute(&theDummy, &theDummy, qname, type, value);
155 }
156
157 /**
158 * Adds an attribute to the attribute list. Does not check for
159 * duplicates.
160 *
161 * @param uri attribute namespace URI
162 * @param localName attribute local name
163 * @param qname attribute qname
164 * @param type attribute type, "CDATA," for example
165 * @param value attribute value
166 */
167 void
169 const XMLCh* uri,
170 const XMLCh* localName,
171 const XMLCh* qname,
172 const XMLCh* type,
173 const XMLCh* value);
174
175 /**
176 * Removes an attribute from the attribute list
177 *
178 * @param qname attribute qname
179 */
180 virtual bool
182
183 /**
184 * Swap the contents of two instances. This must _never_
185 * throw an exception.
186 *
187 * @param thOther The instance with which to swap.
188 */
189 void
191 {
192 m_attributesVector.swap(theOther.m_attributesVector);
193 }
194
195 /**
196 * Reserve room for the given number of
197 * attributes.
198 *
199 * @param theCount The number to reserve
200 */
201 void
203 {
204 m_attributesVector.reserve(theCount);
205 }
206
207 // This vector will hold the entries.
209
210private:
211
212 // This is not implemented.
213 bool
214 operator==(const AttributesImpl&) const;
215
216 // Default vector allocation size.
217 enum
218 {
219 eDefaultVectorSize = 5
220 };
221
223 getNewEntry(
224 const XMLCh* qname,
225 const XMLCh* type,
226 const XMLCh* value,
227 const XMLCh* uri = 0,
228 const XMLCh* localName = 0);
229
230 // Helper function to delete entries...
231 static void
232 deleteEntries(AttributesVectorType& theVector);
233
234 AttributesVectorType m_attributesVector;
235
236 AttributesVectorType m_cacheVector;
237};
238
239
240
241}
242
243
244
245#endif // ATTRIBUTESIMPL_HEADER_GUARD_1357924680
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_DEFAULT_MEMMGR
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
virtual XalanSize_t getLength() const
virtual const XMLCh * getQName(const XalanSize_t index) const
virtual const XMLCh * getValue(const XMLCh *const qname) const
AttributesImpl(const AttributesType &theSource, MemoryManager &theManager)
XalanVector< AttributeVectorEntryExtended * > AttributesVectorType
virtual void clear()
Remove all attributes from the list.
virtual bool getIndex(const XMLCh *const uri, const XMLCh *const localPart, XalanSize_t &index) const
virtual const XMLCh * getValue(const XMLCh *const uri, const XMLCh *const localName) const
virtual const XMLCh * getType(const XalanSize_t index) const
virtual const XMLCh * getValue(const XalanSize_t index) const
virtual const XMLCh * getType(const XMLCh *const qname) const
AttributesImpl & operator=(const AttributesType &theRHS)
AttributesImpl(const AttributesImpl &theSource, MemoryManager &theManager)
AttributesImpl & operator=(const AttributesImpl &theRHS)
void addAttribute(const XMLCh *qname, const XMLCh *type, const XMLCh *value)
Adds an attribute to the attribute list.
void swap(AttributesImpl &theOther)
Swap the contents of two instances.
virtual bool getIndex(const XMLCh *const qName, XalanSize_t &index) const
AttributesImpl(MemoryManager &theManager XALAN_DEFAULT_MEMMGR)
virtual int getIndex(const XMLCh *const uri, const XMLCh *const localPart) const
void reserve(XalanSize_t theCount)
Reserve room for the given number of attributes.
virtual int getIndex(const XMLCh *const qname) const
virtual const XMLCh * getLocalName(const XalanSize_t index) const
virtual bool removeAttribute(const XMLCh *qname)
Removes an attribute from the attribute list.
MemoryManager & getMemoryManager()
virtual const XMLCh * getURI(const XalanSize_t index) const
virtual const XMLCh * getType(const XMLCh *const uri, const XMLCh *const localName) const
void addAttribute(const XMLCh *uri, const XMLCh *localName, const XMLCh *qname, const XMLCh *type, const XMLCh *value)
Adds an attribute to the attribute list.
xercesc::Attributes AttributesType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)