Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

AttributesImpl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(ATTRIBUTESIMPL_HEADER_GUARD_1357924680)
17 #define ATTRIBUTESIMPL_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base include file. Must be first.
23 
24 
25 
27 
28 
29 
30 #include <xercesc/sax2/Attributes.hpp>
31 
32 
33 
34 XALAN_CPP_NAMESPACE_BEGIN
35 
36 
37 
39 
40 
41 
42 typedef XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType;
43 
44 
45 
47 {
48 public:
49 
50  explicit
52 
53  virtual
54  ~AttributesImpl();
55 
56  AttributesImpl(const AttributesImpl& theSource,
57  MemoryManagerType& theManager);
58 
59  AttributesImpl(const AttributesType& theSource,
60  MemoryManagerType& theManager);
61 
63  operator=(const AttributesImpl& theRHS);
64 
66  operator=(const AttributesType& theRHS);
67 
68  // These are inherited from AttributeList
69  virtual unsigned int
70  getLength() const;
71 
72  virtual const XMLCh*
73  getURI(const unsigned int index) const;
74 
75  virtual const XMLCh*
76  getLocalName(const unsigned int index) const;
77 
78  virtual const XMLCh*
79  getQName(const unsigned int index) const;
80 
81  virtual const XMLCh*
82  getType(const unsigned int index) const;
83 
84  virtual const XMLCh*
85  getValue(const unsigned int index) const;
86 
87  virtual int
88  getIndex(
89  const XMLCh* const uri,
90  const XMLCh* const localName) const;
91 
92  virtual int
93  getIndex(const XMLCh* const qname) const;
94 
95  virtual const XMLCh*
96  getType(const XMLCh* const qname) const;
97 
98  virtual const XMLCh*
99  getType(
100  const XMLCh* const uri,
101  const XMLCh* const localName) const;
102 
103  virtual const XMLCh*
104  getValue(const XMLCh* const qname) const;
105 
106  virtual const XMLCh*
107  getValue(
108  const XMLCh* const uri,
109  const XMLCh* const localName) const;
110 
113  {
114  return m_attributesVector.getMemoryManager();
115  }
116 
117  // The mutators are new to this class.
118 
122  virtual void
123  clear();
124 
133  void
135  const XMLCh* qname,
136  const XMLCh* type,
137  const XMLCh* value)
138  {
139  const XMLCh theDummy = 0;
140 
141  addAttribute(&theDummy, &theDummy, qname, type, value);
142  }
143 
154  void
155  addAttribute(
156  const XMLCh* uri,
157  const XMLCh* localName,
158  const XMLCh* qname,
159  const XMLCh* type,
160  const XMLCh* value);
161 
167  virtual bool
168  removeAttribute(const XMLCh* qname);
169 
176  void
177  swap(AttributesImpl& theOther)
178  {
179  m_attributesVector.swap(theOther.m_attributesVector);
180  }
181 
188  void
189  reserve(unsigned int theCount)
190  {
191  m_attributesVector.reserve(theCount);
192  }
193 
194  // This vector will hold the entries.
196 
197 #if defined(XALAN_NEEDS_EXPLICIT_TEMPLATE_INSTANTIATION)
198  struct NameCompareFunctor
199  {
200  NameCompareFunctor(const XMLCh* theQName) :
201  m_qname(theQName)
202  {
203  }
204 
205  bool
206  operator()(const AttributeVectorEntryExtended* theEntry) const;
207 
208  private:
209 
210  const XMLCh* const m_qname;
211  };
212 
213  struct URIAndLocalNameCompareFunctor
214  {
215  URIAndLocalNameCompareFunctor(
216  const XMLCh* theURI,
217  const XMLCh* theLocalName) :
218  m_uri(theURI),
219  m_localName(theLocalName)
220  {
221  }
222 
223  bool
224  operator()(const AttributeVectorEntryExtended* theEntry) const;
225 
226  private:
227 
228  const XMLCh* const m_uri;
229  const XMLCh* const m_localName;
230  };
231 #endif
232 
233 private:
234 
235  // This is not implemented.
236  bool
237  operator==(const AttributesImpl&) const;
238 
239  // Default vector allocation size.
240  enum
241  {
242  eDefaultVectorSize = 5
243  };
244 
246  getNewEntry(
247  const XMLCh* qname,
248  const XMLCh* type,
249  const XMLCh* value,
250  const XMLCh* uri = 0,
251  const XMLCh* localName = 0);
252 
253  // Helper function to delete entries...
254  static void
255  deleteEntries(AttributesVectorType& theVector);
256 
257  AttributesVectorType m_attributesVector;
258 
259  AttributesVectorType m_cacheVector;
260 };
261 
262 
263 
264 XALAN_CPP_NAMESPACE_END
265 
266 
267 
268 #endif // ATTRIBUTESIMPL_HEADER_GUARD_1357924680
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1111
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
void addAttribute(const XMLCh *qname, const XMLCh *type, const XMLCh *value)
Adds an attribute to the attribute list.
Definition: AttributesImpl.hpp:134
void clear(XalanDOMString &theString)
Remove all elements from target string.
Definition: DOMStringHelper.hpp:2291
#define XALAN_DEFAULT_MEMMGR
Definition: XalanMemoryManagement.hpp:402
MemoryManagerType & getMemoryManager()
Definition: AttributesImpl.hpp:112
Definition: AttributeVectorEntryExtended.hpp:34
void swap(AttributesImpl &theOther)
Swap the contents of two instances.
Definition: AttributesImpl.hpp:177
XalanVector< AttributeVectorEntryExtended * > AttributesVectorType
Definition: AttributesImpl.hpp:195
Definition: AttributesImpl.hpp:46
#define XALAN_PLATFORMSUPPORT_EXPORT
Definition: PlatformSupportDefinitions.hpp:33
XERCES_CPP_NAMESPACE_QUALIFIER Attributes AttributesType
Definition: AttributesImpl.hpp:38
void reserve(unsigned int theCount)
Reserve room for the given number of attributes.
Definition: AttributesImpl.hpp:189

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo