Xalan-C++ API Reference 1.12.0
XalanDOMStringAllocator.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
19#if !defined(XALANDOMSTRINGALLOCATOR_INCLUDE_GUARD_12455133)
20#define XALANDOMSTRINGALLOCATOR_INCLUDE_GUARD_12455133
21
22
23
24// Base include file. Must be first.
26
27
28
30
31
32
34
35
36
37namespace XALAN_CPP_NAMESPACE {
38
39
40
42{
43public:
44
47
48#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
50
53#else
55#endif
56
58
59 enum { eDefaultBlockSize = 32 };
60
61
62 /**
63 * Construct an instance that will allocate in blocks of the specified size.
64 *
65 * @param theBlockSize The block size.
66 */
68
70
71 /**
72 * Create a XalanDOMString object.
73 *
74 * @return pointer to the new instance
75 */
78
79 /**
80 * Create a XalanDOMString object.
81 *
82 * @param theString A pointer to a character string
83 * @param theCount The number of characters in the string, or npos if the string is null-terminated.
84 *
85 * @return pointer to the new instance
86 */
89 const char* theString,
90#if defined(_MSC_VER) && (_MSC_VER <= 1300)
91 // $$$ ToDo: Some strange bug in MSVC++ complains when using data_type::npos here.
93#else
95#endif
96
97 /**
98 * Copy constructor
99 *
100 * @param theSource The source string for the copy
101 * @param theStartPosition The position to start in the source string.
102 * @param theCount The number of characters to copy from the source string.
103 *
104 * @return pointer to the new instance
105 */
106 data_type*
108 const data_type& theSource,
111
112 /**
113 * Create a XalanDOMString object.
114 *
115 * @param theString A pointer to a wide character string
116 * @param theCount The number of characters in the string, or npos if the string is null-terminated.
117 *
118 * @return pointer to the new instance
119 */
120 data_type*
122 const XalanDOMChar* theString,
124
125 /**
126 * Create a XalanDOMString object.
127 *
128 * @param theCount the size of the string
129 * @param theChar the character used to initialize the string
130 *
131 * @return pointer to the new instance
132 */
133 data_type*
137
138 /**
139 * Determine if an object is owned by the allocator...
140 */
141 bool
143 {
144 return m_allocator.ownsObject(theObject);
145 }
146
147 /**
148 * Delete all instance objects from allocator.
149 */
150 void
152 {
153 m_allocator.reset();
154 }
155
156 /**
157 * Get the number of ArenaBlocks currently allocated.
158 *
159 * @return The number of blocks.
160 */
163 {
164 return m_allocator.getBlockCount();
165 }
166
167 /**
168 * Get size of an ArenaBlock, that is, the number
169 * of objects in each block.
170 *
171 * @return The size of the block
172 */
175 {
176 return m_allocator.getBlockSize();
177 }
178
179 /**
180 * Get a reference to the MemoryManager instance
181 * for this instance.
182 *
183 * @return A reference to the MemoryManager instance.
184 */
185 MemoryManager&
187 {
188 return m_allocator.getMemoryManager();
189 }
190
191 /**
192 * Get a reference to the MemoryManager instance
193 * for this instance.
194 *
195 * @return A reference to the MemoryManager instance.
196 */
197 const MemoryManager&
199 {
200 return m_allocator.getMemoryManager();
201 }
202
203private:
204
205 // Not implemented...
207
209 operator=(const XalanDOMStringAllocator&);
210
211 // Data members...
212 ArenaAllocatorType m_allocator;
213};
214
215
216
217}
218
219
220
221#endif // XALANDOMSTRINGALLOCATOR_INCLUDE_GUARD_12455133
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
ArenaBlockType::size_type size_type
XalanDOMStringAllocator(MemoryManager &theManager, size_type theBlockCount)
Construct an instance that will allocate in blocks of the specified size.
data_type * create(const data_type &theSource, data_type_size_type theStartPosition=0, data_type_size_type theCount=data_type_size_type(data_type::npos))
Copy constructor.
bool ownsObject(const data_type *theObject)
Determine if an object is owned by the allocator...
const MemoryManager & getMemoryManager() const
Get a reference to the MemoryManager instance for this instance.
size_type getBlockSize() const
Get size of an ArenaBlock, that is, the number of objects in each block.
data_type * create(const XalanDOMChar *theString, data_type_size_type theCount=data_type_size_type(data_type::npos))
Create a XalanDOMString object.
size_type getBlockCount() const
Get the number of ArenaBlocks currently allocated.
data_type * create(data_type_size_type theCount, XalanDOMChar theChar)
Create a XalanDOMString object.
void reset()
Delete all instance objects from allocator.
data_type * create()
Create a XalanDOMString object.
ArenaAllocatorType::size_type size_type
ArenaAllocator< data_type > ArenaAllocatorType
MemoryManager & getMemoryManager()
Get a reference to the MemoryManager instance for this instance.
data_type * create(const char *theString, data_type_size_type theCount=data_type_size_type(data_type::npos))
Create a XalanDOMString object.
void reset(MemoryManager *theManager=0, Type *thePointer=0)
size_t size_type
Definition XalanMap.hpp:46