Xalan-C++ API Reference  1.12.0
AttributeListImpl.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(ATTRIBUTELISTIMPL_HEADER_GUARD_1357924680)
19 #define ATTRIBUTELISTIMPL_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
29 
30 
31 
32 #include <xercesc/sax/AttributeList.hpp>
33 
34 
35 
36 
37 namespace XALAN_CPP_NAMESPACE {
38 
39 
40 
42 
43 
44 
45 typedef xercesc::AttributeList AttributeListType;
46 
47 
48 
50 {
51 public:
52 
53  explicit
54  AttributeListImpl(MemoryManager& theManager);
55 
56  virtual
58 
59  AttributeListImpl(const AttributeListImpl& theSource,
60  MemoryManager& theManager);
61 
62  AttributeListImpl(const AttributeListType& theSource,
63  MemoryManager& theManager);
64 
66  operator=(const AttributeListImpl& theRHS);
67 
69  operator=(const AttributeListType& theRHS);
70 
71  MemoryManager&
73  {
74  return m_AttributeVector.getMemoryManager();
75  }
76 
77  // These are inherited from AttributeList
78  virtual XalanSize_t
79  getLength() const;
80 
81  virtual const XMLCh*
82  getName(const XalanSize_t index) const;
83 
84  virtual const XMLCh*
85  getType(const XalanSize_t index) const;
86 
87  virtual const XMLCh*
88  getValue(const XalanSize_t index) const;
89 
90  virtual const XMLCh*
91  getType(const XMLCh* const name) const;
92 
93  virtual const XMLCh*
94  getValue(const XMLCh* const name) const;
95 
96  virtual const XMLCh*
97  getValue(const char* const name) const;
98  // The mutators are new to this class.
99 
100  /**
101  * Remove all attributes from the list
102  */
103  virtual void
104  clear();
105 
106  /**
107  * Adds an attribute to the attribute list
108  *
109  * @param name attribute name
110  * @param type attribute type, "CDATA," for example
111  * @param value attribute value
112  */
113  virtual bool
114  addAttribute(
115  const XMLCh* name,
116  const XMLCh* type,
117  const XMLCh* value);
118 
119  /**
120  * Removes an attribute from the attribute list
121  *
122  * @param name attribute name
123  */
124  virtual bool
125  removeAttribute(const XMLCh* name);
126 
127  /**
128  * Swap the contents of two instances. This must _never_
129  * throw an exception.
130  *
131  * @param thOther The instance with which to swap.
132  */
133  void
135  {
136  m_AttributeVector.swap(theOther.m_AttributeVector);
137  }
138 
139  /**
140  * Reserve room for the given number of
141  * attributes.
142  *
143  * @param theCount The number to reserve
144  */
145  void
146  reserve(XalanSize_t theCount)
147  {
148  m_AttributeVector.reserve(theCount);
149  }
150 
151  // This vector will hold the entries.
153 
154 private:
155 
156  // This is not implemented.
157  bool
158  operator==(const AttributeListImpl&) const;
159 
160  // Default vector allocation size.
161  enum
162  {
163  eDefaultVectorSize = 5
164  };
165 
167  getNewEntry(
168  const XMLCh* name,
169  const XMLCh* type,
170  const XMLCh* value);
171 
172  // Helper function to delete entries...
173  static void
174  deleteEntries(AttributeVectorType& theVector);
175 
176  AttributeVectorType m_AttributeVector;
177 
178  AttributeVectorType m_cacheVector;
179 };
180 
181 
182 
183 }
184 
185 
186 
187 #endif // ATTRIBUTELISTIMPL_HEADER_GUARD_1357924680
xalanc::AttributeListImpl::reserve
void reserve(XalanSize_t theCount)
Reserve room for the given number of attributes.
Definition: AttributeListImpl.hpp:146
xalanc::AttributeVectorEntry
Definition: AttributeVectorEntry.hpp:38
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
xalanc::AttributeListType
xercesc::AttributeList AttributeListType
Definition: AttributeListImpl.hpp:41
xalanc::clear
void clear(XalanDOMString &theString)
Remove all elements from target string.
Definition: DOMStringHelper.hpp:2475
xalanc::XalanVector< AttributeVectorEntry * >
xalanc::AttributeListImpl::getMemoryManager
MemoryManager & getMemoryManager()
Definition: AttributeListImpl.hpp:72
XalanVector.hpp
xalanc::operator==
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
Definition: XalanVector.hpp:1118
XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_PLATFORMSUPPORT_EXPORT
Definition: PlatformSupportDefinitions.hpp:35
PlatformSupportDefinitions.hpp
xalanc::AttributeListImpl::AttributeVectorType
XalanVector< AttributeVectorEntry * > AttributeVectorType
Definition: AttributeListImpl.hpp:152
xalanc::AttributeListImpl
Definition: AttributeListImpl.hpp:49
xalanc::AttributeListImpl::swap
void swap(AttributeListImpl &theOther)
Swap the contents of two instances.
Definition: AttributeListImpl.hpp:134