00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #if !defined(XALANDOMSTRINGALLOCATOR_INCLUDE_GUARD_12455133) 00018 #define XALANDOMSTRINGALLOCATOR_INCLUDE_GUARD_12455133 00019 00020 00021 00022 // Base include file. Must be first. 00023 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00024 00025 00026 00027 #include <xalanc/PlatformSupport/ArenaAllocator.hpp> 00028 00029 00030 00031 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00032 00033 00034 00035 XALAN_CPP_NAMESPACE_BEGIN 00036 00037 00038 00039 class XALAN_PLATFORMSUPPORT_EXPORT XalanDOMStringAllocator 00040 { 00041 public: 00042 00043 typedef XalanDOMString data_type; 00044 typedef data_type::size_type data_type_size_type; 00045 00046 #if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS) 00047 typedef ArenaBlock<data_type> ArenaBlockType; 00048 00049 typedef ArenaAllocator<data_type, 00050 ArenaBlockType> ArenaAllocatorType; 00051 #else 00052 typedef ArenaAllocator<data_type> ArenaAllocatorType; 00053 #endif 00054 00055 typedef ArenaAllocatorType::size_type size_type; 00056 00057 enum { eDefaultBlockSize = 32 }; 00058 00059 00065 XalanDOMStringAllocator(MemoryManagerType& theManager, size_type theBlockCount); 00066 00067 ~XalanDOMStringAllocator(); 00068 00074 data_type* 00075 create(); 00076 00085 data_type* 00086 create( 00087 const char* theString, 00088 #if defined(_MSC_VER) && (_MSC_VER <= 1300) 00089 // $$$ ToDo: Some strange bug in MSVC++ complains when using data_type::npos here. 00090 data_type_size_type theCount = data_type_size_type(-1)); 00091 #else 00092 data_type_size_type theCount = data_type_size_type(data_type::npos)); 00093 #endif 00094 00104 data_type* 00105 create( 00106 const data_type& theSource, 00107 data_type_size_type theStartPosition = 0, 00108 data_type_size_type theCount = data_type_size_type(data_type::npos)); 00109 00118 data_type* 00119 create( 00120 const XalanDOMChar* theString, 00121 data_type_size_type theCount = data_type_size_type(data_type::npos)); 00122 00131 data_type* 00132 create( 00133 data_type_size_type theCount, 00134 XalanDOMChar theChar); 00135 00139 bool 00140 ownsObject(const data_type* theObject) 00141 { 00142 return m_allocator.ownsObject(theObject); 00143 } 00144 00148 void 00149 reset() 00150 { 00151 m_allocator.reset(); 00152 } 00153 00159 size_type 00160 getBlockCount() const 00161 { 00162 return m_allocator.getBlockCount(); 00163 } 00164 00171 size_type 00172 getBlockSize() const 00173 { 00174 return m_allocator.getBlockSize(); 00175 } 00176 00183 MemoryManagerType& 00184 getMemoryManager() 00185 { 00186 return m_allocator.getMemoryManager(); 00187 } 00188 00195 const MemoryManagerType& 00196 getMemoryManager() const 00197 { 00198 return m_allocator.getMemoryManager(); 00199 } 00200 00201 private: 00202 00203 // Not implemented... 00204 XalanDOMStringAllocator(const XalanDOMStringAllocator&); 00205 00206 XalanDOMStringAllocator& 00207 operator=(const XalanDOMStringAllocator&); 00208 00209 // Data members... 00210 ArenaAllocatorType m_allocator; 00211 }; 00212 00213 00214 00215 XALAN_CPP_NAMESPACE_END 00216 00217 00218 00219 #endif // XALANDOMSTRINGALLOCATOR_INCLUDE_GUARD_12455133
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|