| <HTML><HEAD><TITLE>Xalan-C++ API Documentation</TITLE></HEAD>
|
| <BODY>
|
| <h2 align="center">Xalan-C++ API Documentation</h2>
|
| <h3 align="center">The Xalan C++ XSLT Processor Version 1.10</h3>
|
| </BODY> |
| <!-- Generated by Doxygen 1.2.8.1 --> |
| <center> |
| <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> |
| <hr><h1>XalanVector.hpp</h1><a href="XalanVector_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <font class="comment">/*</font> |
| 00002 <font class="comment"> * Copyright 1999-2004 The Apache Software Foundation.</font> |
| 00003 <font class="comment"> *</font> |
| 00004 <font class="comment"> * Licensed under the Apache License, Version 2.0 (the "License");</font> |
| 00005 <font class="comment"> * you may not use this file except in compliance with the License.</font> |
| 00006 <font class="comment"> * You may obtain a copy of the License at</font> |
| 00007 <font class="comment"> *</font> |
| 00008 <font class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</font> |
| 00009 <font class="comment"> *</font> |
| 00010 <font class="comment"> * Unless required by applicable law or agreed to in writing, software</font> |
| 00011 <font class="comment"> * distributed under the License is distributed on an "AS IS" BASIS,</font> |
| 00012 <font class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</font> |
| 00013 <font class="comment"> * See the License for the specific language governing permissions and</font> |
| 00014 <font class="comment"> * limitations under the License.</font> |
| 00015 <font class="comment"> */</font> |
| 00016 |
| 00021 |
| 00022 <font class="preprocessor">#if !defined(XALANVECTOR_HEADER_GUARD_1357924680)</font> |
| <a name="l00023"></a><a class="code" href="XalanVector_8hpp.html#a0">00023</a> <font class="preprocessor"></font><font class="preprocessor">#define XALANVECTOR_HEADER_GUARD_1357924680</font> |
| 00024 <font class="preprocessor"></font> |
| 00025 |
| 00026 |
| 00027 <font class="comment">// Base include file. Must be first.</font> |
| 00028 <font class="preprocessor">#include <<a class="code" href="PlatformDefinitions_8hpp.html">xalanc/Include/PlatformDefinitions.hpp</a>></font> |
| 00029 |
| 00030 |
| 00031 <font class="preprocessor">#include <<a class="code" href="XalanMemoryManagement_8hpp.html">xalanc/Include/XalanMemoryManagement.hpp</a>></font> |
| 00032 <font class="preprocessor">#include <<a class="code" href="XalanMemMgrAutoPtr_8hpp.html">xalanc/Include/XalanMemMgrAutoPtr.hpp</a>></font> |
| 00033 |
| 00034 |
| 00035 <font class="preprocessor">#include <cstddef></font> |
| 00036 <font class="preprocessor">#include <algorithm></font> |
| 00037 <font class="preprocessor">#include <cassert></font> |
| 00038 <font class="preprocessor">#include <new></font> |
| 00039 <font class="preprocessor">#include <iterator></font> |
| 00040 <font class="preprocessor">#include <stdexcept></font> |
| 00041 |
| 00042 |
| 00043 |
| 00044 |
| 00045 |
| 00046 XALAN_CPP_NAMESPACE_BEGIN |
| 00047 |
| 00048 |
| 00049 <font class="preprocessor">#if defined(_MSC_VER)</font> |
| 00050 <font class="preprocessor"></font><font class="preprocessor">#pragma warning(push)</font> |
| 00051 <font class="preprocessor"></font><font class="preprocessor">#pragma warning(disable: 4100)</font> |
| 00052 <font class="preprocessor"></font><font class="preprocessor">#endif</font> |
| 00053 <font class="preprocessor"></font> |
| 00054 |
| 00055 |
| <a name="l00056"></a><a class="code" href="XalanVector_8hpp.html#a1">00056</a> <a class="code" href="XSLTInputSource_8hpp.html#a3">XALAN_USING_XERCES</a>(MemoryManager) |
| 00057 |
| 00058 |
| 00059 |
| 00060 template <class Type, class ConstructionTraits = MemoryManagedConstructionTraits<Type> > |
| 00061 <font class="keyword">class </font>XalanVector |
| 00062 { |
| 00063 <font class="keyword">public</font>: |
| 00064 |
| 00065 |
| 00066 <font class="keyword">typedef</font> Type value_type; |
| 00067 <font class="keyword">typedef</font> value_type* pointer; |
| 00068 <font class="keyword">typedef</font> <font class="keyword">const</font> value_type* const_pointer; |
| 00069 <font class="keyword">typedef</font> value_type& reference; |
| 00070 <font class="keyword">typedef</font> <font class="keyword">const</font> value_type& const_reference; |
| 00071 <font class="keyword">typedef</font> size_t size_type; |
| 00072 <font class="keyword">typedef</font> ptrdiff_t difference_type; |
| 00073 |
| 00074 <font class="preprocessor">#if defined(XALAN_VCPP_USE_PTRIT)</font> |
| 00075 <font class="preprocessor"></font> <font class="keyword">typedef</font> std::_Ptrit< |
| 00076 Type, |
| 00077 ptrdiff_t, |
| 00078 pointer, |
| 00079 reference, |
| 00080 pointer, |
| 00081 reference> iterator; |
| 00082 |
| 00083 <font class="keyword">typedef</font> std::_Ptrit< |
| 00084 Type, |
| 00085 ptrdiff_t, |
| 00086 const_pointer, |
| 00087 const_reference, |
| 00088 pointer, |
| 00089 reference> const_iterator; |
| 00090 <font class="preprocessor">#else</font> |
| 00091 <font class="preprocessor"></font> <font class="keyword">typedef</font> value_type* iterator; |
| 00092 <font class="keyword">typedef</font> <font class="keyword">const</font> value_type* const_iterator; |
| 00093 <font class="preprocessor">#endif</font> |
| 00094 <font class="preprocessor"></font> |
| 00095 <font class="preprocessor">#if defined(XALAN_HAS_STD_ITERATORS)</font> |
| 00096 <font class="preprocessor"></font> <font class="keyword">typedef</font> XALAN_STD_QUALIFIER reverse_iterator<iterator> reverse_iterator_; |
| 00097 <font class="keyword">typedef</font> XALAN_STD_QUALIFIER reverse_iterator<const_iterator> const_reverse_iterator_; |
| 00098 <font class="preprocessor">#elif defined(XALAN_RW_NO_CLASS_PARTIAL_SPEC)</font> |
| 00099 <font class="preprocessor"></font> <font class="keyword">typedef</font> XALAN_STD_QUALIFIER reverse_iterator< |
| 00100 iterator, |
| 00101 XALAN_STD_QUALIFIER random_access_iterator_tag, |
| 00102 value_type> reverse_iterator_; |
| 00103 <font class="keyword">typedef</font> XALAN_STD_QUALIFIER reverse_iterator< |
| 00104 const_iterator, |
| 00105 XALAN_STD_QUALIFIER random_access_iterator_tag, |
| 00106 <font class="keyword">const</font> value_type> const_reverse_iterator_; |
| 00107 <font class="preprocessor">#else</font> |
| 00108 <font class="preprocessor"></font> <font class="keyword">typedef</font> XALAN_STD_QUALIFIER reverse_iterator<iterator, value_type> reverse_iterator_; |
| 00109 <font class="keyword">typedef</font> XALAN_STD_QUALIFIER reverse_iterator<const_iterator, value_type, const_reference> const_reverse_iterator_; |
| 00110 <font class="preprocessor">#endif</font> |
| 00111 <font class="preprocessor"></font> |
| 00112 <font class="keyword">typedef</font> reverse_iterator_ reverse_iterator; |
| 00113 <font class="keyword">typedef</font> const_reverse_iterator_ const_reverse_iterator; |
| 00114 |
| 00115 <font class="keyword">typedef</font> XalanVector<value_type, ConstructionTraits> <a class="code" href="classXalanDeque.html">ThisType</a>; |
| 00116 |
| 00117 <font class="keyword">typedef</font> <font class="keyword">typename</font> ConstructionTraits::Constructor <a class="code" href="structMemoryManagedConstructionTraits.html">Constructor</a>; |
| 00118 <font class="keyword">typedef</font> <font class="keyword">typename</font> Constructor::ConstructableType ConstructibleType; |
| 00119 |
| 00120 XalanVector( |
| 00121 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMORY_MGR, |
| 00122 size_type initialAllocation = <a class="code" href="XalanMap_8hpp.html#a1">size_type</a>(0)) : |
| 00123 m_memoryManager(&theManager), |
| 00124 m_size(0), |
| 00125 m_allocation(initialAllocation), |
| 00126 m_data(initialAllocation > 0 ? allocate(initialAllocation) : 0) |
| 00127 { |
| 00128 invariants(); |
| 00129 } |
| 00130 |
| 00131 <font class="keyword">static</font> XalanVector* |
| 00132 create( |
| 00133 MemoryManager& theManager, |
| 00134 size_type initialAllocation = <a class="code" href="XalanMap_8hpp.html#a1">size_type</a>(0)) |
| 00135 { |
| 00136 <font class="keyword">typedef</font> XalanVector <a class="code" href="classXalanDeque.html">ThisType</a>; |
| 00137 |
| 00138 XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (<a class="code" href="classXalanDeque.html">ThisType</a>*)theManager.allocate(<font class="keyword">sizeof</font>(<a class="code" href="classXalanDeque.html">ThisType</a>))); |
| 00139 |
| 00140 <a class="code" href="classXalanDeque.html">ThisType</a>* theResult = theGuard.get(); |
| 00141 |
| 00142 <font class="keyword">new</font> (theResult) ThisType(theManager, initialAllocation); |
| 00143 |
| 00144 theGuard.release(); |
| 00145 |
| 00146 <font class="keywordflow">return</font> theResult; |
| 00147 } |
| 00148 |
| 00149 XalanVector( |
| 00150 <font class="keyword">const</font> <a class="code" href="classXalanDeque.html">ThisType</a>& theSource, |
| 00151 MemoryManager& theManager XALAN_DEFAULT_CONSTRUCTOR_MEMORY_MGR, |
| 00152 size_type theInitialAllocation = <a class="code" href="XalanMap_8hpp.html#a1">size_type</a>(0)) : |
| 00153 m_memoryManager(&theManager), |
| 00154 m_size(0), |
| 00155 m_allocation(0), |
| 00156 m_data(0)<font class="keyword"></font> |
| 00157 <font class="keyword"> </font>{ |
| 00158 <font class="keywordflow">if</font> (theSource.m_size > 0) |
| 00159 { |
| 00160 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(theManager, local_max(theSource.m_size, theInitialAllocation)); |
| 00161 |
| 00162 theTemp.insert(theTemp.begin(), theSource.<a class="code" href="classXalanDeque.html#a3">begin</a>(), theSource.<a class="code" href="classXalanDeque.html#a5">end</a>()); |
| 00163 |
| 00164 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 00165 |
| 00166 } |
| 00167 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (theInitialAllocation > 0) |
| 00168 { |
| 00169 m_data = allocate(theInitialAllocation); |
| 00170 |
| 00171 m_allocation = theInitialAllocation; |
| 00172 } |
| 00173 |
| 00174 invariants(); |
| 00175 } |
| 00176 |
| 00177 XalanVector( |
| 00178 const_iterator theFirst, |
| 00179 const_iterator theLast, |
| 00180 MemoryManager& theManager) : |
| 00181 m_memoryManager(&theManager), |
| 00182 m_size(0), |
| 00183 m_allocation(0), |
| 00184 m_data(0)<font class="keyword"></font> |
| 00185 <font class="keyword"></font> |
| 00186 <font class="keyword"> </font>{ |
| 00187 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(theManager); |
| 00188 |
| 00189 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a3">begin</a>(), theFirst, theLast); |
| 00190 |
| 00191 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 00192 |
| 00193 invariants(); |
| 00194 } |
| 00195 |
| 00196 <font class="keyword">static</font> XalanVector* |
| 00197 create( |
| 00198 const_iterator theFirst, |
| 00199 const_iterator theLast, |
| 00200 MemoryManager& theManager)<font class="keyword"></font> |
| 00201 <font class="keyword"> </font>{ |
| 00202 <font class="keyword">typedef</font> XalanVector <a class="code" href="classXalanDeque.html">ThisType</a>; |
| 00203 |
| 00204 XalanMemMgrAutoPtr<ThisType, false> theGuard( theManager , (<a class="code" href="classXalanDeque.html">ThisType</a>*)theManager.allocate(<font class="keyword">sizeof</font>(<a class="code" href="classXalanDeque.html">ThisType</a>))); |
| 00205 |
| 00206 <a class="code" href="classXalanDeque.html">ThisType</a>* theResult = theGuard.get(); |
| 00207 |
| 00208 <font class="keyword">new</font> (theResult) ThisType(theFirst, theLast, theManager); |
| 00209 |
| 00210 theGuard.release(); |
| 00211 |
| 00212 <font class="keywordflow">return</font> theResult; |
| 00213 } |
| 00214 |
| 00215 XalanVector( |
| 00216 size_type theInsertSize, |
| 00217 <font class="keyword">const</font> value_type& theData, |
| 00218 MemoryManager& theManager) : |
| 00219 m_memoryManager(&theManager), |
| 00220 m_size(0), |
| 00221 m_allocation(0), |
| 00222 m_data(0)<font class="keyword"></font> |
| 00223 <font class="keyword"> </font>{ |
| 00224 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(theManager); |
| 00225 |
| 00226 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a3">begin</a>(), theInsertSize, theData); |
| 00227 |
| 00228 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 00229 |
| 00230 invariants(); |
| 00231 } |
| 00232 |
| 00233 ~XalanVector()<font class="keyword"></font> |
| 00234 <font class="keyword"> </font>{ |
| 00235 invariants(); |
| 00236 |
| 00237 <font class="keywordflow">if</font> (m_allocation != 0) |
| 00238 { |
| 00239 destroy(begin(), end()); |
| 00240 |
| 00241 deallocate(m_data); |
| 00242 } |
| 00243 } |
| 00244 |
| 00245 <font class="keywordtype">void</font> |
| 00246 push_back(<font class="keyword">const</font> value_type& data)<font class="keyword"></font> |
| 00247 <font class="keyword"> </font>{ |
| 00248 invariants(); |
| 00249 |
| 00250 doPushBack(data); |
| 00251 |
| 00252 invariants(); |
| 00253 } |
| 00254 |
| 00255 <font class="keywordtype">void</font> |
| 00256 pop_back()<font class="keyword"></font> |
| 00257 <font class="keyword"> </font>{ |
| 00258 invariants(); |
| 00259 |
| 00260 --m_size; |
| 00261 |
| 00262 destroy(m_data[m_size]); |
| 00263 |
| 00264 invariants(); |
| 00265 } |
| 00266 |
| 00267 iterator |
| 00268 <a class="code" href="DOMStringHelper_8hpp.html#a81">erase</a>( |
| 00269 iterator theFirst, |
| 00270 iterator theLast)<font class="keyword"></font> |
| 00271 <font class="keyword"> </font>{ |
| 00272 invariants(); |
| 00273 |
| 00274 <font class="keywordflow">if</font> (theFirst != theLast) |
| 00275 { |
| 00276 XALAN_STD_QUALIFIER copy( |
| 00277 theLast, |
| 00278 end(), |
| 00279 theFirst); |
| 00280 |
| 00281 shrinkCount(local_distance(theFirst, theLast)); |
| 00282 } |
| 00283 |
| 00284 invariants(); |
| 00285 |
| 00286 <font class="keywordflow">return</font> theFirst; |
| 00287 } |
| 00288 |
| 00289 iterator |
| 00290 <a class="code" href="DOMStringHelper_8hpp.html#a81">erase</a>(iterator position)<font class="keyword"></font> |
| 00291 <font class="keyword"> </font>{ |
| 00292 <font class="keywordflow">return</font> <a class="code" href="DOMStringHelper_8hpp.html#a81">erase</a>(position, position + 1); |
| 00293 } |
| 00294 |
| 00295 <font class="keywordtype">void</font> |
| 00296 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>( |
| 00297 iterator thePosition, |
| 00298 const_iterator theFirst, |
| 00299 const_iterator theLast)<font class="keyword"></font> |
| 00300 <font class="keyword"> </font>{ |
| 00301 <font class="comment">// Since we're using bare pointers for now, we can</font> |
| 00302 <font class="comment">// assert this...</font> |
| 00303 assert(theFirst <= theLast); |
| 00304 assert(thePosition >= begin()); |
| 00305 assert(thePosition <= end()); |
| 00306 |
| 00307 invariants(); |
| 00308 |
| 00309 <font class="keyword">const</font> size_type theInsertSize = |
| 00310 local_distance(theFirst, theLast); |
| 00311 |
| 00312 <font class="keywordflow">if</font> (theInsertSize == 0) |
| 00313 { |
| 00314 <font class="keywordflow">return</font>; |
| 00315 } |
| 00316 |
| 00317 <font class="keyword">const</font> size_type theTotalSize = size() + theInsertSize; |
| 00318 |
| 00319 <font class="keywordflow">if</font> (thePosition == end()) |
| 00320 { |
| 00321 pointer thePointer = ensureCapacity(theTotalSize); |
| 00322 |
| 00323 <font class="keywordflow">while</font> (theFirst != theLast) |
| 00324 { |
| 00325 Constructor::construct(thePointer, *theFirst, *m_memoryManager); |
| 00326 |
| 00327 ++thePointer; |
| 00328 ++m_size; |
| 00329 ++theFirst; |
| 00330 } |
| 00331 } |
| 00332 <font class="keywordflow">else</font> |
| 00333 { |
| 00334 <font class="keywordflow">if</font> (theTotalSize > capacity()) |
| 00335 { |
| 00336 assert (m_memoryManager != 0); |
| 00337 |
| 00338 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(*m_memoryManager, theTotalSize); |
| 00339 |
| 00340 <font class="comment">// insert everything up to the position...</font> |
| 00341 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a5">end</a>(), begin(), thePosition); |
| 00342 |
| 00343 <font class="comment">// insert the new stuff...</font> |
| 00344 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a5">end</a>(), theFirst, theLast); |
| 00345 |
| 00346 <font class="comment">// insert everything from the position to the end...</font> |
| 00347 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a5">end</a>(), thePosition, end()); |
| 00348 |
| 00349 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 00350 } |
| 00351 <font class="keywordflow">else</font> |
| 00352 { |
| 00353 <font class="comment">// insert into the middle of the vector that has enough capacity</font> |
| 00354 <font class="keyword">const</font> iterator theOriginalEnd = end(); |
| 00355 |
| 00356 <font class="keyword">const</font> size_type theRightSplitSize = |
| 00357 local_distance(thePosition, theOriginalEnd); |
| 00358 |
| 00359 <font class="keywordflow">if</font> (theRightSplitSize <= theInsertSize) |
| 00360 { |
| 00361 <font class="comment">// inserted range will go to or beyond edge of current vector</font> |
| 00362 |
| 00363 <font class="comment">// append from inserted range, all values that will extend </font> |
| 00364 <font class="comment">// beyond the current vector</font> |
| 00365 <font class="keyword">const</font> const_iterator toInsertSplit = theFirst + theRightSplitSize; |
| 00366 const_iterator toInsertIter = toInsertSplit; |
| 00367 |
| 00368 <font class="keywordflow">while</font> (toInsertIter != theLast) |
| 00369 { |
| 00370 doPushBack(*toInsertIter); |
| 00371 |
| 00372 ++toInsertIter; |
| 00373 } |
| 00374 |
| 00375 <font class="comment">// copy the "right" of the current vector to the end</font> |
| 00376 toInsertIter = thePosition; |
| 00377 <font class="keywordflow">while</font> (toInsertIter != theOriginalEnd) |
| 00378 { |
| 00379 doPushBack(*toInsertIter); |
| 00380 |
| 00381 ++toInsertIter; |
| 00382 } |
| 00383 |
| 00384 <font class="comment">// copy the remaining part of inserted range into </font> |
| 00385 <font class="comment">// the original vector spaces</font> |
| 00386 XALAN_STD_QUALIFIER copy(theFirst, toInsertSplit, thePosition); |
| 00387 } |
| 00388 <font class="keywordflow">else</font> |
| 00389 { |
| 00390 <font class="comment">// inserted range will not extend beyond edge of current vector</font> |
| 00391 |
| 00392 <font class="comment">// move end of current vector by insertion size</font> |
| 00393 const_iterator toMoveIter = end() - theInsertSize; |
| 00394 |
| 00395 <font class="keywordflow">while</font> (toMoveIter != theOriginalEnd) |
| 00396 { |
| 00397 doPushBack(*toMoveIter); |
| 00398 |
| 00399 ++toMoveIter; |
| 00400 } |
| 00401 |
| 00402 <font class="comment">// reverse copy the remaining part of the "right" piece of the current vector</font> |
| 00403 XALAN_STD_QUALIFIER copy_backward(thePosition, theOriginalEnd - theInsertSize, theOriginalEnd); |
| 00404 |
| 00405 <font class="comment">// insert into current vector</font> |
| 00406 XALAN_STD_QUALIFIER copy(theFirst, theLast, thePosition); |
| 00407 } |
| 00408 } |
| 00409 } |
| 00410 |
| 00411 invariants(); |
| 00412 } |
| 00413 |
| 00414 <font class="keywordtype">void</font> |
| 00415 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>( |
| 00416 iterator thePosition, |
| 00417 size_type theCount, |
| 00418 <font class="keyword">const</font> value_type& theData)<font class="keyword"></font> |
| 00419 <font class="keyword"> </font>{ |
| 00420 invariants(); |
| 00421 |
| 00422 <font class="keyword">const</font> size_type theTotalSize = size() + theCount; |
| 00423 |
| 00424 <font class="comment">// Needs to be optimized</font> |
| 00425 <font class="keywordflow">if</font> (thePosition == end()) |
| 00426 { |
| 00427 pointer thePointer = ensureCapacity(theTotalSize); |
| 00428 |
| 00429 <font class="keywordflow">for</font> (size_type index = 0; index < theCount; ++index) |
| 00430 { |
| 00431 Constructor::construct(thePointer, theData, *m_memoryManager); |
| 00432 |
| 00433 ++thePointer; |
| 00434 ++m_size; |
| 00435 } |
| 00436 } |
| 00437 <font class="keywordflow">else</font> |
| 00438 { |
| 00439 <font class="keywordflow">if</font> (theTotalSize > capacity()) |
| 00440 { |
| 00441 assert ( m_memoryManager != 0 ); |
| 00442 |
| 00443 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(*m_memoryManager, theTotalSize); |
| 00444 |
| 00445 <font class="comment">// insert everything up to the position...</font> |
| 00446 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a5">end</a>(), begin(), thePosition); |
| 00447 |
| 00448 <font class="comment">// insert the new stuff...</font> |
| 00449 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a5">end</a>(), theCount, theData); |
| 00450 |
| 00451 <font class="comment">// insert everything from the position to the end...</font> |
| 00452 theTemp.<a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theTemp.<a class="code" href="classXalanDeque.html#a5">end</a>(), thePosition, end()); |
| 00453 |
| 00454 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 00455 } |
| 00456 <font class="keywordflow">else</font> |
| 00457 { |
| 00458 <font class="comment">// insert into the middle of the vector that has enough capacity </font> |
| 00459 <font class="keyword">const</font> iterator theOriginalEnd = end(); |
| 00460 |
| 00461 <font class="keyword">const</font> size_type theRightSplitSize = |
| 00462 local_distance(thePosition, theOriginalEnd); |
| 00463 |
| 00464 <font class="keywordflow">if</font> (theRightSplitSize <= theCount) |
| 00465 { |
| 00466 <font class="comment">// inserted range will go to or beyond edge of current vector</font> |
| 00467 |
| 00468 <font class="comment">// append all copies that will extend </font> |
| 00469 <font class="comment">// beyond the current vector</font> |
| 00470 <font class="keywordflow">for</font> (size_type i = 0; i < (theCount - theRightSplitSize); ++i) |
| 00471 { |
| 00472 doPushBack(theData); |
| 00473 } |
| 00474 |
| 00475 <font class="comment">// copy the "right" of the current vector to the end</font> |
| 00476 iterator toInsertIter = thePosition; |
| 00477 |
| 00478 <font class="keywordflow">while</font> (toInsertIter != theOriginalEnd) |
| 00479 { |
| 00480 doPushBack(*toInsertIter); |
| 00481 |
| 00482 ++toInsertIter; |
| 00483 } |
| 00484 |
| 00485 <font class="comment">// copy the remaining part of inserted range into </font> |
| 00486 <font class="comment">// the original vector spaces</font> |
| 00487 XALAN_STD_QUALIFIER fill(thePosition, thePosition + theRightSplitSize, theData); |
| 00488 } |
| 00489 <font class="keywordflow">else</font> |
| 00490 { |
| 00491 <font class="comment">// inserted range will not extend beyond edge of current vector</font> |
| 00492 |
| 00493 <font class="comment">// move end of current vector by insertion size</font> |
| 00494 const_iterator toMoveIter = end() - theCount; |
| 00495 |
| 00496 <font class="keywordflow">while</font> (toMoveIter != theOriginalEnd) |
| 00497 { |
| 00498 doPushBack(*toMoveIter); |
| 00499 |
| 00500 ++toMoveIter; |
| 00501 } |
| 00502 |
| 00503 <font class="comment">// reverse copy the remaining part of the "right" piece of the current vector</font> |
| 00504 XALAN_STD_QUALIFIER copy_backward(thePosition, theOriginalEnd - theCount, theOriginalEnd); |
| 00505 |
| 00506 <font class="comment">// insert into current vector</font> |
| 00507 XALAN_STD_QUALIFIER fill(thePosition, thePosition + theCount, theData); |
| 00508 } |
| 00509 } |
| 00510 } |
| 00511 |
| 00512 invariants(); |
| 00513 } |
| 00514 |
| 00515 iterator |
| 00516 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>( |
| 00517 iterator thePosition, |
| 00518 <font class="keyword">const</font> value_type& theData)<font class="keyword"></font> |
| 00519 <font class="keyword"> </font>{ |
| 00520 <font class="keywordflow">if</font> (m_allocation > m_size) |
| 00521 { |
| 00522 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(thePosition, 1, theData); |
| 00523 |
| 00524 <font class="keywordflow">return</font> thePosition; |
| 00525 } |
| 00526 <font class="keywordflow">else</font> |
| 00527 { |
| 00528 <font class="keyword">const</font> size_type theDistance = |
| 00529 local_distance(begin(), thePosition); |
| 00530 |
| 00531 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(thePosition, 1, theData); |
| 00532 |
| 00533 <font class="keywordflow">return</font> begin() + theDistance; |
| 00534 } |
| 00535 } |
| 00536 |
| 00537 <font class="keywordtype">void</font> |
| 00538 <a class="code" href="DOMStringHelper_8hpp.html#a72">assign</a>( |
| 00539 const_iterator theFirst, |
| 00540 const_iterator theLast)<font class="keyword"></font> |
| 00541 <font class="keyword"> </font>{ |
| 00542 <a class="code" href="DOMStringHelper_8hpp.html#a80">clear</a>(); |
| 00543 |
| 00544 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>( |
| 00545 begin(), |
| 00546 theFirst, |
| 00547 theLast); |
| 00548 } |
| 00549 |
| 00550 <font class="keywordtype">void</font> |
| 00551 <a class="code" href="DOMStringHelper_8hpp.html#a72">assign</a>( |
| 00552 iterator theFirst, |
| 00553 iterator theLast)<font class="keyword"></font> |
| 00554 <font class="keyword"> </font>{ |
| 00555 <a class="code" href="DOMStringHelper_8hpp.html#a72">assign</a>( |
| 00556 const_iterator(theFirst), |
| 00557 const_iterator(theLast)); |
| 00558 } |
| 00559 |
| 00560 <font class="keywordtype">void</font> |
| 00561 <a class="code" href="DOMStringHelper_8hpp.html#a72">assign</a>( |
| 00562 size_type theCount, |
| 00563 <font class="keyword">const</font> value_type& theData)<font class="keyword"></font> |
| 00564 <font class="keyword"> </font>{ |
| 00565 <a class="code" href="DOMStringHelper_8hpp.html#a80">clear</a>(); |
| 00566 |
| 00567 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>(theCount, theData); |
| 00568 } |
| 00569 |
| 00570 size_type |
| 00571 size()<font class="keyword"> const</font> |
| 00572 <font class="keyword"> </font>{ |
| 00573 invariants(); |
| 00574 |
| 00575 <font class="keywordflow">return</font> m_size; |
| 00576 } |
| 00577 |
| 00578 size_type |
| 00579 max_size()<font class="keyword"> const</font> |
| 00580 <font class="keyword"> </font>{ |
| 00581 invariants(); |
| 00582 |
| 00583 <font class="keywordflow">return</font> ~size_type(0); |
| 00584 } |
| 00585 |
| 00586 <font class="keywordtype">void</font> |
| 00587 resize(size_type theSize)<font class="keyword"></font> |
| 00588 <font class="keyword"> </font>{ |
| 00589 <font class="keyword">const</font> ConstructibleType defaultValue(*m_memoryManager); |
| 00590 |
| 00591 resize(theSize, defaultValue.value); |
| 00592 } |
| 00593 |
| 00594 <font class="keywordtype">void</font> |
| 00595 resize( size_type theSize, |
| 00596 <font class="keyword">const</font> value_type& theValue)<font class="keyword"></font> |
| 00597 <font class="keyword"> </font>{ |
| 00598 invariants(); |
| 00599 |
| 00600 <font class="keywordflow">if</font> (m_size > theSize) |
| 00601 { |
| 00602 shrinkToSize(theSize); |
| 00603 } |
| 00604 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (m_size < theSize) |
| 00605 { |
| 00606 <font class="comment">// Reserve memory up-front...</font> |
| 00607 <a class="code" href="DOMStringHelper_8hpp.html#a11">reserve</a>(theSize); |
| 00608 |
| 00609 assert(m_allocation >= theSize); |
| 00610 |
| 00611 <font class="keyword">const</font> value_type* <font class="keyword">const</font> theEnd = m_data + theSize; |
| 00612 |
| 00613 <font class="comment">// Fill the new area...</font> |
| 00614 <font class="keywordflow">for</font> (value_type* data = endPointer(); |
| 00615 data != theEnd; |
| 00616 ++data, ++m_size) |
| 00617 { |
| 00618 Constructor::construct(data, theValue, *m_memoryManager); |
| 00619 } |
| 00620 } |
| 00621 |
| 00622 assert(m_size == theSize); |
| 00623 |
| 00624 invariants(); |
| 00625 } |
| 00626 |
| 00627 size_type |
| 00628 capacity()<font class="keyword"> const</font> |
| 00629 <font class="keyword"> </font>{ |
| 00630 invariants(); |
| 00631 |
| 00632 <font class="keywordflow">return</font> m_allocation; |
| 00633 } |
| 00634 |
| 00635 <font class="keywordtype">bool</font> |
| 00636 empty()<font class="keyword"> const</font> |
| 00637 <font class="keyword"> </font>{ |
| 00638 invariants(); |
| 00639 |
| 00640 <font class="keywordflow">return</font> m_size == 0 ? <font class="keyword">true</font> : <font class="keyword">false</font>; |
| 00641 } |
| 00642 |
| 00643 <font class="keywordtype">void</font> |
| 00644 <a class="code" href="DOMStringHelper_8hpp.html#a11">reserve</a>(size_type theSize)<font class="keyword"></font> |
| 00645 <font class="keyword"> </font>{ |
| 00646 invariants(); |
| 00647 |
| 00648 <font class="keywordflow">if</font> (theSize > m_allocation) |
| 00649 { |
| 00650 doReserve(theSize); |
| 00651 } |
| 00652 |
| 00653 invariants(); |
| 00654 } |
| 00655 |
| 00656 reference |
| 00657 front()<font class="keyword"></font> |
| 00658 <font class="keyword"> </font>{ |
| 00659 invariants(); |
| 00660 |
| 00661 <font class="keywordflow">return</font> m_data[0]; |
| 00662 } |
| 00663 |
| 00664 const_reference |
| 00665 front()<font class="keyword"> const</font> |
| 00666 <font class="keyword"> </font>{ |
| 00667 invariants(); |
| 00668 |
| 00669 <font class="keywordflow">return</font> m_data[0]; |
| 00670 } |
| 00671 |
| 00672 reference |
| 00673 back()<font class="keyword"></font> |
| 00674 <font class="keyword"> </font>{ |
| 00675 <font class="keywordflow">return</font> m_data[m_size - 1]; |
| 00676 } |
| 00677 |
| 00678 const_reference |
| 00679 back()<font class="keyword"> const</font> |
| 00680 <font class="keyword"> </font>{ |
| 00681 <font class="keywordflow">return</font> m_data[m_size - 1]; |
| 00682 } |
| 00683 |
| 00684 iterator |
| 00685 begin()<font class="keyword"></font> |
| 00686 <font class="keyword"> </font>{ |
| 00687 invariants(); |
| 00688 |
| 00689 <font class="keywordflow">return</font> m_data; |
| 00690 } |
| 00691 |
| 00692 const_iterator |
| 00693 begin()<font class="keyword"> const</font> |
| 00694 <font class="keyword"> </font>{ |
| 00695 invariants(); |
| 00696 |
| 00697 <font class="keywordflow">return</font> m_data; |
| 00698 } |
| 00699 |
| 00700 iterator |
| 00701 end()<font class="keyword"></font> |
| 00702 <font class="keyword"> </font>{ |
| 00703 invariants(); |
| 00704 |
| 00705 <font class="keywordflow">return</font> endPointer(); |
| 00706 } |
| 00707 |
| 00708 const_iterator |
| 00709 end()<font class="keyword"> const</font> |
| 00710 <font class="keyword"> </font>{ |
| 00711 invariants(); |
| 00712 |
| 00713 <font class="keywordflow">return</font> endPointer(); |
| 00714 } |
| 00715 |
| 00716 reverse_iterator |
| 00717 rbegin()<font class="keyword"></font> |
| 00718 <font class="keyword"> </font>{ |
| 00719 invariants(); |
| 00720 |
| 00721 <font class="keywordflow">return</font> reverse_iterator(end()); |
| 00722 } |
| 00723 |
| 00724 const_reverse_iterator |
| 00725 rbegin()<font class="keyword"> const</font> |
| 00726 <font class="keyword"> </font>{ |
| 00727 invariants(); |
| 00728 |
| 00729 <font class="keywordflow">return</font> const_reverse_iterator(end()); |
| 00730 } |
| 00731 |
| 00732 reverse_iterator |
| 00733 rend()<font class="keyword"></font> |
| 00734 <font class="keyword"> </font>{ |
| 00735 invariants(); |
| 00736 |
| 00737 <font class="keywordflow">return</font> reverse_iterator(begin()); |
| 00738 } |
| 00739 |
| 00740 const_reverse_iterator |
| 00741 rend()<font class="keyword"> const</font> |
| 00742 <font class="keyword"> </font>{ |
| 00743 invariants(); |
| 00744 |
| 00745 <font class="keywordflow">return</font> const_reverse_iterator(begin()); |
| 00746 } |
| 00747 |
| 00748 |
| 00749 reference |
| 00750 at(size_type theIndex)<font class="keyword"></font> |
| 00751 <font class="keyword"> </font>{ |
| 00752 <font class="keywordflow">if</font> (theIndex >= m_size) |
| 00753 { |
| 00754 outOfRange(); |
| 00755 } |
| 00756 |
| 00757 <font class="keywordflow">return</font> m_data[theIndex]; |
| 00758 } |
| 00759 |
| 00760 const_reference |
| 00761 at(size_type theIndex)<font class="keyword"> const</font> |
| 00762 <font class="keyword"> </font>{ |
| 00763 <font class="keywordflow">if</font> (theIndex >= m_size) |
| 00764 { |
| 00765 outOfRange(); |
| 00766 } |
| 00767 |
| 00768 <font class="keywordflow">return</font> m_data[theIndex]; |
| 00769 } |
| 00770 |
| 00771 reference |
| 00772 operator[](size_type theIndex)<font class="keyword"></font> |
| 00773 <font class="keyword"> </font>{ |
| 00774 assert (theIndex < m_size); |
| 00775 |
| 00776 <font class="keywordflow">return</font> m_data[theIndex]; |
| 00777 } |
| 00778 |
| 00779 const_reference |
| 00780 operator[](size_type theIndex)<font class="keyword"> const</font> |
| 00781 <font class="keyword"> </font>{ |
| 00782 assert (theIndex < m_size); |
| 00783 |
| 00784 <font class="keywordflow">return</font> m_data[theIndex]; |
| 00785 } |
| 00786 |
| 00787 <font class="keywordtype">void</font> |
| 00788 <a class="code" href="DOMStringHelper_8hpp.html#a80">clear</a>()<font class="keyword"></font> |
| 00789 <font class="keyword"> </font>{ |
| 00790 invariants(); |
| 00791 |
| 00792 <font class="keywordflow">if</font> (m_size > 0) |
| 00793 { |
| 00794 shrinkToSize(0); |
| 00795 } |
| 00796 |
| 00797 invariants(); |
| 00798 } |
| 00799 |
| 00800 <font class="comment">// Operators...</font> |
| 00801 <a class="code" href="classXalanDeque.html">ThisType</a>& |
| 00802 operator=(<font class="keyword">const</font> <a class="code" href="classXalanDeque.html">ThisType</a>& theRHS)<font class="keyword"></font> |
| 00803 <font class="keyword"> </font>{ |
| 00804 invariants(); |
| 00805 |
| 00806 <font class="keywordflow">if</font> (&theRHS != <font class="keyword">this</font>) |
| 00807 { |
| 00808 <font class="keywordflow">if</font> (m_allocation < theRHS.m_size) |
| 00809 { |
| 00810 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(theRHS,*m_memoryManager); |
| 00811 |
| 00812 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 00813 } |
| 00814 <font class="keywordflow">else</font> |
| 00815 { |
| 00816 const_iterator theRHSCopyEnd = theRHS.<a class="code" href="classXalanDeque.html#a5">end</a>(); |
| 00817 |
| 00818 <font class="keywordflow">if</font> (m_size > theRHS.m_size) |
| 00819 { |
| 00820 <font class="comment">// Resize to the target size...</font> |
| 00821 shrinkToSize(theRHS.m_size); |
| 00822 } |
| 00823 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (m_size < theRHS.m_size) |
| 00824 { |
| 00825 theRHSCopyEnd = |
| 00826 theRHS.<a class="code" href="classXalanDeque.html#a3">begin</a>() + m_size; |
| 00827 |
| 00828 <a class="code" href="DOMStringHelper_8hpp.html#a79">insert</a>( |
| 00829 end(), |
| 00830 theRHSCopyEnd, |
| 00831 theRHS.<a class="code" href="classXalanDeque.html#a5">end</a>()); |
| 00832 } |
| 00833 |
| 00834 <font class="comment">// Copy everything that already exists...</font> |
| 00835 XALAN_STD_QUALIFIER copy( |
| 00836 theRHS.<a class="code" href="classXalanDeque.html#a3">begin</a>(), |
| 00837 theRHSCopyEnd, |
| 00838 begin()); |
| 00839 } |
| 00840 } |
| 00841 |
| 00842 invariants(); |
| 00843 |
| 00844 <font class="keywordflow">return</font> *<font class="keyword">this</font>; |
| 00845 } |
| 00846 |
| 00847 <font class="keywordtype">void</font> |
| 00848 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(<a class="code" href="classXalanDeque.html">ThisType</a>& theOther)<font class="keyword"></font> |
| 00849 <font class="keyword"> </font>{ |
| 00850 invariants(); |
| 00851 |
| 00852 MemoryManager* <font class="keyword">const</font> theTempManager = m_memoryManager; |
| 00853 <font class="keyword">const</font> size_type theTempLength = m_size; |
| 00854 <font class="keyword">const</font> size_type theTempAllocation = m_allocation; |
| 00855 value_type* <font class="keyword">const</font> theTempData = m_data; |
| 00856 |
| 00857 m_memoryManager = theOther.m_memoryManager; |
| 00858 m_size = theOther.m_size; |
| 00859 m_allocation = theOther.m_allocation; |
| 00860 m_data = theOther.m_data; |
| 00861 |
| 00862 theOther.m_memoryManager = theTempManager; |
| 00863 theOther.m_size = theTempLength; |
| 00864 theOther.m_allocation = theTempAllocation; |
| 00865 theOther.m_data = theTempData; |
| 00866 |
| 00867 invariants(); |
| 00868 } |
| 00869 |
| 00870 <font class="keyword">const</font> MemoryManager* |
| 00871 getMemoryManager()<font class="keyword"> const</font> |
| 00872 <font class="keyword"> </font>{ |
| 00873 <font class="keywordflow">return</font> m_memoryManager; |
| 00874 } |
| 00875 |
| 00876 MemoryManager& |
| 00877 getMemoryManager()<font class="keyword"></font> |
| 00878 <font class="keyword"> </font>{ |
| 00879 assert (m_memoryManager != 0); |
| 00880 |
| 00881 <font class="keywordflow">return</font> *m_memoryManager; |
| 00882 } |
| 00883 |
| 00884 <font class="comment">// Detaches the allocated memory from the vector, and returns</font> |
| 00885 <font class="comment">// the pointer to the caller. The caller then owns the memory</font> |
| 00886 <font class="comment">// and must destroy any objects and deallocate it using the</font> |
| 00887 <font class="comment">// the memory manager returned from getMemoryManager()</font> |
| 00888 pointer |
| 00889 detach()<font class="keyword"></font> |
| 00890 <font class="keyword"> </font>{ |
| 00891 m_size = 0; |
| 00892 m_allocation = 0; |
| 00893 |
| 00894 value_type* <font class="keyword">const</font> theTemp = m_data; |
| 00895 |
| 00896 m_data = 0; |
| 00897 |
| 00898 <font class="keywordflow">return</font> theTemp; |
| 00899 } |
| 00900 |
| 00901 <font class="keyword">private</font>: |
| 00902 |
| 00903 <font class="preprocessor">#if defined(NDEBUG)</font> |
| 00904 <font class="preprocessor"></font> <font class="keywordtype">void</font> |
| 00905 invariants()<font class="keyword"> const</font> |
| 00906 <font class="keyword"> </font>{ |
| 00907 } |
| 00908 <font class="preprocessor">#else</font> |
| 00909 <font class="preprocessor"></font> <font class="keywordtype">void</font> |
| 00910 invariants()<font class="keyword"> const</font> |
| 00911 <font class="keyword"> </font>{ |
| 00912 assert(m_allocation >= m_size); |
| 00913 assert(m_data == 0 && m_allocation == 0 || m_data != 0 && m_allocation != 0); |
| 00914 } |
| 00915 <font class="preprocessor">#endif</font> |
| 00916 <font class="preprocessor"></font> |
| 00917 size_type |
| 00918 local_distance( |
| 00919 const_iterator theFirst, |
| 00920 const_iterator theLast)<font class="keyword"></font> |
| 00921 <font class="keyword"> </font>{ |
| 00922 <font class="comment">// Since we're using bare pointers for now, we can</font> |
| 00923 <font class="comment">// assert this...</font> |
| 00924 assert(theFirst <= theLast); |
| 00925 |
| 00926 <font class="preprocessor">#if defined(XALAN_HAS_STD_DISTANCE)</font> |
| 00927 <font class="preprocessor"></font> <font class="keywordflow">return</font> XALAN_STD_QUALIFIER distance(theFirst, theLast); |
| 00928 <font class="preprocessor">#else</font> |
| 00929 <font class="preprocessor"></font> size_type theDistance; |
| 00930 |
| 00931 XALAN_STD_QUALIFIER distance(theFirst, theLast, theDistance); |
| 00932 |
| 00933 <font class="keywordflow">return</font> theDistance; |
| 00934 <font class="preprocessor">#endif</font> |
| 00935 <font class="preprocessor"></font> } |
| 00936 |
| 00937 value_type* |
| 00938 allocate(size_type size)<font class="keyword"></font> |
| 00939 <font class="keyword"> </font>{ |
| 00940 <font class="keyword">const</font> size_type theBytesNeeded = size * <font class="keyword">sizeof</font>(value_type); |
| 00941 |
| 00942 assert (m_memoryManager != 0); |
| 00943 |
| 00944 <font class="keywordtype">void</font>* pointer = m_memoryManager->allocate(theBytesNeeded); |
| 00945 |
| 00946 assert(pointer != 0); |
| 00947 |
| 00948 <font class="keywordflow">return</font> (value_type*) pointer; |
| 00949 } |
| 00950 |
| 00951 <font class="keywordtype">void</font> |
| 00952 deallocate(value_type* pointer)<font class="keyword"></font> |
| 00953 <font class="keyword"> </font>{ |
| 00954 assert(m_memoryManager != 0); |
| 00955 |
| 00956 m_memoryManager->deallocate(pointer); |
| 00957 |
| 00958 } |
| 00959 |
| 00960 <font class="keyword">static</font> <font class="keywordtype">void</font> |
| 00961 destroy(value_type& theValue)<font class="keyword"></font> |
| 00962 <font class="keyword"> </font>{ |
| 00963 theValue.~Type(); |
| 00964 } |
| 00965 |
| 00966 <font class="keyword">static</font> <font class="keywordtype">void</font> |
| 00967 destroy( |
| 00968 iterator theFirst, |
| 00969 iterator theLast)<font class="keyword"></font> |
| 00970 <font class="keyword"> </font>{ |
| 00971 <font class="keywordflow">for</font>(; theFirst != theLast; ++theFirst) |
| 00972 { |
| 00973 destroy(*theFirst); |
| 00974 } |
| 00975 } |
| 00976 |
| 00977 <font class="keywordtype">void</font> |
| 00978 doPushBack(<font class="keyword">const</font> value_type& data)<font class="keyword"></font> |
| 00979 <font class="keyword"> </font>{ |
| 00980 invariants(); |
| 00981 |
| 00982 <font class="keywordflow">if</font> (m_size < m_allocation) |
| 00983 { |
| 00984 Constructor::construct(endPointer(), data, *m_memoryManager); |
| 00985 |
| 00986 ++m_size; |
| 00987 } |
| 00988 <font class="keywordflow">else</font> |
| 00989 { |
| 00990 assert(m_size == m_allocation); |
| 00991 |
| 00992 <font class="keyword">const</font> size_type theNewSize = m_size == 0 ? 1 : <a class="code" href="XalanMap_8hpp.html#a1">size_type</a>((m_size * 1.6) + 0.5); |
| 00993 assert(theNewSize > m_size); |
| 00994 |
| 00995 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(*<font class="keyword">this</font>, *m_memoryManager, theNewSize); |
| 00996 |
| 00997 theTemp.doPushBack(data); |
| 00998 |
| 00999 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 01000 } |
| 01001 |
| 01002 invariants(); |
| 01003 } |
| 01004 |
| 01005 pointer |
| 01006 ensureCapacity(size_type theSize)<font class="keyword"></font> |
| 01007 <font class="keyword"> </font>{ |
| 01008 <font class="keywordflow">if</font> (theSize > capacity()) |
| 01009 { |
| 01010 doReserve(theSize); |
| 01011 } |
| 01012 |
| 01013 <font class="keywordflow">return</font> endPointer(); |
| 01014 } |
| 01015 |
| 01016 <font class="keywordtype">void</font> |
| 01017 doReserve(size_type theSize)<font class="keyword"></font> |
| 01018 <font class="keyword"> </font>{ |
| 01019 invariants(); |
| 01020 |
| 01021 assert(theSize > m_allocation); |
| 01022 |
| 01023 <a class="code" href="classXalanDeque.html">ThisType</a> theTemp(*<font class="keyword">this</font>, *m_memoryManager, theSize); |
| 01024 |
| 01025 <a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theTemp); |
| 01026 |
| 01027 invariants(); |
| 01028 } |
| 01029 |
| 01030 pointer |
| 01031 endPointer()<font class="keyword"></font> |
| 01032 <font class="keyword"> </font>{ |
| 01033 <font class="keywordflow">return</font> m_data + m_size; |
| 01034 } |
| 01035 |
| 01036 const_pointer |
| 01037 endPointer()<font class="keyword"> const</font> |
| 01038 <font class="keyword"> </font>{ |
| 01039 <font class="keywordflow">return</font> m_data + m_size; |
| 01040 } |
| 01041 |
| 01042 <font class="keyword">static</font> <font class="keywordtype">void</font> |
| 01043 outOfRange()<font class="keyword"></font> |
| 01044 <font class="keyword"> </font>{ |
| 01045 <font class="keywordflow">throw</font> XALAN_STD_QUALIFIER out_of_range(<font class="stringliteral">""</font>); |
| 01046 } |
| 01047 |
| 01048 <font class="keywordtype">void</font> |
| 01049 shrinkToSize(size_type theSize)<font class="keyword"></font> |
| 01050 <font class="keyword"> </font>{ |
| 01051 assert(m_size > theSize); |
| 01052 |
| 01053 <font class="keywordflow">do</font> |
| 01054 { |
| 01055 pop_back(); |
| 01056 } <font class="keywordflow">while</font> (m_size > theSize); |
| 01057 } |
| 01058 |
| 01059 <font class="keywordtype">void</font> |
| 01060 shrinkCount(size_type theCount)<font class="keyword"></font> |
| 01061 <font class="keyword"> </font>{ |
| 01062 assert(m_size >= theCount); |
| 01063 |
| 01064 <font class="keywordflow">while</font> (theCount > 0) |
| 01065 { |
| 01066 pop_back(); |
| 01067 |
| 01068 --theCount; |
| 01069 } |
| 01070 } |
| 01071 |
| 01072 size_type |
| 01073 local_max( |
| 01074 size_type theLHS, |
| 01075 size_type theRHS)<font class="keyword"></font> |
| 01076 <font class="keyword"> </font>{ |
| 01077 <font class="keywordflow">return</font> theLHS > theRHS ? theLHS : theRHS; |
| 01078 } |
| 01079 |
| 01080 <font class="preprocessor">#if defined(XALAN_DEVELOPMENT)</font> |
| 01081 <font class="preprocessor"></font> <font class="comment">//not implemented</font> |
| 01082 XalanVector(<font class="keyword">const</font> XalanVector&); |
| 01083 XalanVector(); |
| 01084 <font class="preprocessor">#endif</font> |
| 01085 <font class="preprocessor"></font> |
| 01086 <font class="comment">// Data members...</font> |
| 01087 MemoryManager* m_memoryManager; |
| 01088 |
| 01089 size_type m_size; |
| 01090 |
| 01091 size_type m_allocation; |
| 01092 |
| 01093 value_type* m_data; |
| 01094 }; |
| 01095 |
| 01096 |
| 01097 |
| 01098 template <class Type> |
| 01099 <font class="keyword">inline</font> <font class="keywordtype">void</font> |
| <a name="l01100"></a><a class="code" href="XalanVector_8hpp.html#a2">01100</a> <a class="code" href="XalanVector_8hpp.html#a2">swap</a>( |
| 01101 XalanVector<Type>& theLHS, |
| 01102 XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01103 <font class="keyword"></font>{ |
| 01104 theLHS.<a class="code" href="XalanVector_8hpp.html#a2">swap</a>(theRHS); |
| 01105 } |
| 01106 |
| 01107 |
| 01108 |
| 01109 template <class Type> |
| 01110 <font class="keyword">inline</font> <font class="keywordtype">bool</font> |
| <a name="l01111"></a><a class="code" href="XalanVector_8hpp.html#a3">01111</a> <a class="code" href="ElemAttributeSet_8hpp.html#a1">operator==</a>( |
| 01112 <font class="keyword">const</font> XalanVector<Type>& theLHS, |
| 01113 <font class="keyword">const</font> XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01114 <font class="keyword"></font>{ |
| 01115 <font class="keywordflow">if</font> (theLHS.size() != theRHS.size()) |
| 01116 { |
| 01117 <font class="keywordflow">return</font> <font class="keyword">false</font>; |
| 01118 } |
| 01119 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (theLHS.size() == 0) |
| 01120 { |
| 01121 <font class="keywordflow">return</font> <font class="keyword">true</font>; |
| 01122 } |
| 01123 <font class="keywordflow">else</font> |
| 01124 { |
| 01125 <font class="keywordflow">return</font> XALAN_STD_QUALIFIER equal(theLHS.begin(), theLHS.end(), theRHS.begin()); |
| 01126 } |
| 01127 } |
| 01128 |
| 01129 |
| 01130 |
| 01131 template <class Type> |
| 01132 <font class="keyword">inline</font> <font class="keywordtype">bool</font> |
| <a name="l01133"></a><a class="code" href="XalanVector_8hpp.html#a4">01133</a> <a class="code" href="XObject_8hpp.html#a3">operator!=</a>( |
| 01134 <font class="keyword">const</font> XalanVector<Type>& theLHS, |
| 01135 <font class="keyword">const</font> XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01136 <font class="keyword"></font>{ |
| 01137 <font class="keywordflow">return</font> !(theLHS == theRHS); |
| 01138 } |
| 01139 |
| 01140 |
| 01141 |
| 01142 template <class Type> |
| 01143 <font class="keyword">inline</font> <font class="keywordtype">bool</font> |
| <a name="l01144"></a><a class="code" href="XalanVector_8hpp.html#a5">01144</a> <a class="code" href="ElemAttributeSet_8hpp.html#a2">operator<</a>( |
| 01145 <font class="keyword">const</font> XalanVector<Type>& theLHS, |
| 01146 <font class="keyword">const</font> XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01147 <font class="keyword"></font>{ |
| 01148 <font class="keywordflow">return</font> XALAN_STD_QUALIFIER lexicographical_compare( |
| 01149 theLHS.begin(), |
| 01150 theLHS.end(), |
| 01151 theRHS.begin(), |
| 01152 theRHS.end()); |
| 01153 } |
| 01154 |
| 01155 |
| 01156 |
| 01157 template <class Type> |
| 01158 <font class="keyword">inline</font> <font class="keywordtype">bool</font> |
| <a name="l01159"></a><a class="code" href="XalanVector_8hpp.html#a6">01159</a> <a class="code" href="XalanVector_8hpp.html#a6">operator<=</a>( |
| 01160 <font class="keyword">const</font> XalanVector<Type>& theLHS, |
| 01161 <font class="keyword">const</font> XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01162 <font class="keyword"></font>{ |
| 01163 <font class="keywordflow">return</font> !(theRHS < theLHS); |
| 01164 } |
| 01165 |
| 01166 |
| 01167 |
| 01168 template <class Type> |
| 01169 <font class="keyword">inline</font> <font class="keywordtype">bool</font> |
| <a name="l01170"></a><a class="code" href="XalanVector_8hpp.html#a7">01170</a> <a class="code" href="XalanVector_8hpp.html#a7">operator></a>( |
| 01171 <font class="keyword">const</font> XalanVector<Type>& theLHS, |
| 01172 <font class="keyword">const</font> XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01173 <font class="keyword"></font>{ |
| 01174 <font class="keywordflow">return</font> theRHS < theLHS; |
| 01175 } |
| 01176 |
| 01177 |
| 01178 |
| 01179 template <class Type> |
| 01180 <font class="keyword">inline</font> <font class="keywordtype">bool</font> |
| <a name="l01181"></a><a class="code" href="XalanVector_8hpp.html#a8">01181</a> <a class="code" href="XalanVector_8hpp.html#a8">operator>=</a>( |
| 01182 <font class="keyword">const</font> XalanVector<Type>& theLHS, |
| 01183 <font class="keyword">const</font> XalanVector<Type>& theRHS)<font class="keyword"></font> |
| 01184 <font class="keyword"></font>{ |
| 01185 <font class="keywordflow">return</font> !(theLHS < theRHS); |
| 01186 } |
| 01187 |
| 01188 |
| 01189 |
| 01190 <font class="preprocessor">#if defined(_MSC_VER)</font> |
| 01191 <font class="preprocessor"></font><font class="preprocessor">#pragma warning(pop)</font> |
| 01192 <font class="preprocessor"></font><font class="preprocessor">#endif</font> |
| 01193 <font class="preprocessor"></font> |
| 01194 |
| 01195 |
| 01196 XALAN_CPP_NAMESPACE_END |
| 01197 |
| 01198 |
| 01199 |
| 01200 <font class="preprocessor">#endif // XALANVECTOR_HEADER_GUARD_1357924680</font> |
| </font></pre></div><p align="center"><a href="diagramnotes.html">Interpreting class diagrams</a></p>
|
| <p><FONT color="#000000" face="arial,helvetica,sanserif" size="-1">
|
| <i><A href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</A> and
|
| <A href="http://www.research.att.com/sw/tools/graphviz/">GraphViz</A> are used to generate this API documentation from the Xalan-C header files.</I></FONT></p>
|
|
|
| <TABLE border="0" cellpadding="0" cellspacing="0" width="820"><TR><TD bgcolor="#0086b2"><IMG height="1" src="../resources/dot.gif" width="1" alt="dot"></TD></TR></TABLE>
|
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="80%">
|
| <TR>
|
| <TD WIDTH="80%" VALIGN="TOP">
|
| <P ALIGN="CENTER"><B>Xalan-C++ XSLT Processor Version 1.10</B><BR>
|
| Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.</i></p>
|
| </TD>
|
| </TR>
|
| <TR>
|
| <TD WIDTH="100%">
|
| <P ALIGN="CENTER"><IMG SRC="ApacheLogo.jpg" WIDTH="387" HEIGHT="100" ALIGN="BOTTOM" BORDER="0" ALT="Apache Logo">
|
| </TD>
|
| </TR>
|
| </TABLE>
|