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 #if !defined(XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680) 00017 #define XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680 00018 00025 00026 // Base include file. Must be first. 00027 #include <xalanc/XSLT/XSLTDefinitions.hpp> 00028 00029 00030 00031 #include <xalanc/Include/XalanVector.hpp> 00032 00033 00034 00035 00036 #include "xalanc/XPath/MutableNodeRefList.hpp" 00037 00038 00039 00040 XALAN_CPP_NAMESPACE_BEGIN 00041 00042 00043 00044 class ElemNumber; 00045 class StylesheetExecutionContext; 00046 00047 00048 00056 struct Counter 00057 { 00058 typedef unsigned long CountType; 00059 00060 typedef XalanVector<XalanNode*> NodeVectorType; 00061 00068 CountType m_countNodesStartCount; 00069 00073 NodeVectorType m_countNodes; 00074 00080 const XalanNode* m_fromNode; 00081 00085 const ElemNumber* m_numberElem; 00086 00090 Counter( 00091 MemoryManagerType& theManager, 00092 const ElemNumber* numberElem, 00093 NodeVectorType& countNodes) : 00094 m_countNodesStartCount(0), 00095 m_countNodes(countNodes, theManager), 00096 m_fromNode(0), 00097 m_numberElem(numberElem) 00098 { 00099 } 00100 00104 Counter(MemoryManagerType& theManager, const ElemNumber* numberElem = 0) : 00105 m_countNodesStartCount(0), 00106 m_countNodes(theManager), 00107 m_fromNode(0), 00108 m_numberElem(numberElem) 00109 { 00110 } 00111 00112 Counter(const Counter& other, MemoryManagerType& theManager) : 00113 m_countNodesStartCount(other.m_countNodesStartCount), 00114 m_countNodes(other.m_countNodes, theManager), 00115 m_fromNode(other.m_fromNode), 00116 m_numberElem(other.m_numberElem) 00117 { 00118 } 00119 00126 CountType 00127 getPreviouslyCounted( 00128 StylesheetExecutionContext& support, 00129 const XalanNode* node) const; 00130 00134 XalanNode* 00135 getLast() const 00136 { 00137 return m_countNodes.empty() == true ? 0 : m_countNodes.back(); 00138 } 00139 00140 private: 00141 // Not implemented 00142 Counter(); 00143 Counter(const Counter&); 00144 }; 00145 00146 XALAN_USES_MEMORY_MANAGER(Counter) 00147 00148 typedef XalanVector<Counter> CounterVectorTypeDecl; 00149 XALAN_USES_MEMORY_MANAGER(CounterVectorTypeDecl) 00150 00151 typedef XalanVector<CounterVectorTypeDecl> ElemCounterVectorVectorTypeDecl; 00152 XALAN_USES_MEMORY_MANAGER(ElemCounterVectorVectorTypeDecl) 00160 class CountersTable 00161 { 00162 public: 00163 00164 typedef Counter::CountType CountType; 00165 00166 typedef CounterVectorTypeDecl CounterVectorType; 00167 typedef ElemCounterVectorVectorTypeDecl ElemCounterVectorVectorType; 00168 00169 typedef Counter::NodeVectorType NodeVectorType; 00170 00174 CountersTable(MemoryManagerType& theManager, 00175 unsigned long theSize = 0) : 00176 m_countersVector(theManager), 00177 m_newFound(theManager) 00178 { 00179 resize(theSize); 00180 }; 00181 00182 ~CountersTable() 00183 { 00184 } 00185 00193 void 00194 resize(unsigned long theSize) 00195 { 00196 m_countersVector.resize(theSize); 00197 } 00198 00208 CountType 00209 countNode( 00210 StylesheetExecutionContext& executionContext, 00211 const ElemNumber& numberElem, 00212 XalanNode* node); 00213 00217 void 00218 reset() 00219 { 00220 m_newFound.clear(); 00221 00222 m_countersVector.clear(); 00223 } 00224 00225 private: 00226 // not implemented 00227 CountersTable(); 00228 CountersTable(const CountersTable&); 00229 00233 ElemCounterVectorVectorType m_countersVector; 00234 00235 00239 NodeVectorType m_newFound; 00240 }; 00241 00242 00243 00244 XALAN_CPP_NAMESPACE_END 00245 00246 00247 00248 #endif // !defined(XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680)
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|