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(size_type theBlockCount); 00066 00067 ~XalanDOMStringAllocator(); 00068 00077 data_type* 00078 create( 00079 const char* theString, 00080 #if defined(_MSC_VER) 00081 // $$$ ToDo: Some strange bug in MSVC++ complains when using data_type::npos here. 00082 data_type_size_type theCount = data_type_size_type(-1)); 00083 #else 00084 data_type_size_type theCount = data_type_size_type(data_type::npos)); 00085 #endif 00086 00096 data_type* 00097 create( 00098 const data_type& theSource, 00099 data_type_size_type theStartPosition = 0, 00100 data_type_size_type theCount = data_type_size_type(data_type::npos)); 00101 00110 data_type* 00111 create( 00112 const XalanDOMChar* theString, 00113 data_type_size_type theCount = data_type_size_type(data_type::npos)); 00114 00123 data_type* 00124 create( 00125 data_type_size_type theCount, 00126 XalanDOMChar theChar); 00127 00131 bool 00132 ownsObject(const data_type* theObject) 00133 { 00134 return m_allocator.ownsObject(theObject); 00135 } 00136 00140 void 00141 reset() 00142 { 00143 m_allocator.reset(); 00144 } 00145 00151 size_type 00152 getBlockCount() const 00153 { 00154 return m_allocator.getBlockCount(); 00155 } 00156 00163 size_type 00164 getBlockSize() const 00165 { 00166 return m_allocator.getBlockSize(); 00167 } 00168 00169 private: 00170 00171 // Not implemented... 00172 XalanDOMStringAllocator(const XalanDOMStringAllocator&); 00173 00174 XalanDOMStringAllocator& 00175 operator=(const XalanDOMStringAllocator&); 00176 00177 // Data members... 00178 ArenaAllocatorType m_allocator; 00179 }; 00180 00181 00182 00183 XALAN_CPP_NAMESPACE_END 00184 00185 00186 00187 #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.8 |
|