Xerces-C++ 3.2.5
PSVIAttributeList.hpp
Go to the documentation of this file.
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$
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_LIST_HPP)
23#define XERCESC_INCLUDE_GUARD_PSVIATTRIBUTE_LIST_HPP
24
27#include <xercesc/util/RefVectorOf.hpp>
28
30
40{
41public:
43 fPSVIAttribute(0)
44 , fAttributeName(0)
45 , fAttributeNamespace(0)
46 {
47 }
48
50 {
51 delete fPSVIAttribute;
52 }
53
57};
58
60{
61public:
62
63 // Constructors and Destructor
64 // -----------------------------------------------------------------------
67
74
76
81
82 //---------------------
86
87 /*
88 * Get the number of attributes whose PSVI contributions
89 * are contained in this list.
90 */
92
93 /*
94 * Get the PSVI contribution of attribute at position i
95 * in this list. Indices start from 0.
96 * @param index index from which the attribute PSVI contribution
97 * is to come.
98 * @return PSVIAttribute containing the attributes PSVI contributions;
99 * null is returned if the index is out of range.
100 */
102
103 /*
104 * Get local part of attribute name at position index in the list.
105 * Indices start from 0.
106 * @param index index from which the attribute name
107 * is to come.
108 * @return local part of the attribute's name; null is returned if the index
109 * is out of range.
110 */
112
113 /*
114 * Get namespace of attribute at position index in the list.
115 * Indices start from 0.
116 * @param index index from which the attribute namespace
117 * is to come.
118 * @return namespace of the attribute;
119 * null is returned if the index is out of range.
120 */
122
123 /*
124 * Get the PSVI contribution of attribute with given
125 * local name and namespace.
126 * @param attrName local part of the attribute's name
127 * @param attrNamespace namespace of the attribute
128 * @return null if the attribute PSVI does not exist
129 */
131 , const XMLCh * attrNamespace);
132
134
135 //----------------------------------
139
148 PSVIAttribute *getPSVIAttributeToFill(
149 const XMLCh * attrName
150 , const XMLCh * attrNS);
151
155 void reset();
156
158
159private:
160
161 // -----------------------------------------------------------------------
162 // Unimplemented constructors and operators
163 // -----------------------------------------------------------------------
165 PSVIAttributeList & operator=(const PSVIAttributeList &);
166
167
168 // -----------------------------------------------------------------------
169 // data members
170 // -----------------------------------------------------------------------
171 // fMemoryManager
172 // handler to provide dynamically-need memory
173 // fAttrList
174 // list of PSVIAttributes contained by this object
175 // fAttrPos
176 // current number of initialized PSVIAttributes in fAttrList
177 MemoryManager* fMemoryManager;
178 RefVectorOf<PSVIAttributeStorage>* fAttrList;
179 XMLSize_t fAttrPos;
180};
181
183{
184 delete fAttrList;
185}
186
188 const XMLCh *attrName
189 , const XMLCh * attrNS)
190{
191 PSVIAttributeStorage* storage = 0;
192 if(fAttrPos == fAttrList->size())
193 {
194 storage = new (fMemoryManager) PSVIAttributeStorage();
195 storage->fPSVIAttribute = new (fMemoryManager) PSVIAttribute(fMemoryManager);
196 fAttrList->addElement(storage);
197 }
198 else
199 {
200 storage = fAttrList->elementAt(fAttrPos);
201 }
202 storage->fAttributeName = attrName;
203 storage->fAttributeNamespace = attrNS;
204 fAttrPos++;
205 return storage->fPSVIAttribute;
206}
207
209{
210 fAttrPos = 0;
211}
212
214
215#endif
#define XMLPARSER_EXPORT
Definition XercesDefs.hpp:163
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
uint16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
Configurable memory manager.
Definition MemoryManager.hpp:40
Definition PSVIAttributeList.hpp:60
void reset()
reset the list
Definition PSVIAttributeList.hpp:208
const XMLCh * getAttributeNamespaceAtIndex(const XMLSize_t index)
PSVIAttributeList(MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
The default constructor.
PSVIAttribute * getAttributePSVIByName(const XMLCh *attrName, const XMLCh *attrNamespace)
PSVIAttribute * getAttributePSVIAtIndex(const XMLSize_t index)
const XMLCh * getAttributeNameAtIndex(const XMLSize_t index)
~PSVIAttributeList()
Definition PSVIAttributeList.hpp:182
PSVIAttribute * getPSVIAttributeToFill(const XMLCh *attrName, const XMLCh *attrNS)
methods needed by implementation
Definition PSVIAttributeList.hpp:187
XMLSize_t getLength() const
A container for the PSVI contributions to attributes that occur on a particular element.
Definition PSVIAttributeList.hpp:40
const XMLCh * fAttributeNamespace
Definition PSVIAttributeList.hpp:56
PSVIAttributeStorage()
Definition PSVIAttributeList.hpp:42
const XMLCh * fAttributeName
Definition PSVIAttributeList.hpp:55
~PSVIAttributeStorage()
Definition PSVIAttributeList.hpp:49
PSVIAttribute * fPSVIAttribute
Definition PSVIAttributeList.hpp:54
Definition PSVIAttribute.hpp:42
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition PlatformUtils.hpp:121
This class makes it possible to override the C++ memory management by adding new/delete operators to ...
Definition XMemory.hpp:41