Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

CountersTable.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680)
17 #define XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680
18 
26 // Base include file. Must be first.
28 
29 
30 
32 
33 
34 
35 
37 
38 
39 
40 XALAN_CPP_NAMESPACE_BEGIN
41 
42 
43 
44 class ElemNumber;
46 
47 
48 
56 struct Counter
57 {
58  typedef unsigned long CountType;
59 
61 
69 
74 
81 
86 
91  MemoryManagerType& theManager,
92  const ElemNumber* numberElem,
93  NodeVectorType& countNodes) :
95  m_countNodes(countNodes, theManager),
96  m_fromNode(0),
97  m_numberElem(numberElem)
98  {
99  }
100 
104  Counter(MemoryManagerType& theManager, const ElemNumber* numberElem = 0) :
106  m_countNodes(theManager),
107  m_fromNode(0),
108  m_numberElem(numberElem)
109  {
110  }
111 
112  Counter(const Counter& other, MemoryManagerType& theManager) :
114  m_countNodes(other.m_countNodes, theManager),
115  m_fromNode(other.m_fromNode),
117  {
118  }
119 
126  CountType
129  const XalanNode* node) const;
130 
134  XalanNode*
135  getLast() const
136  {
137  return m_countNodes.empty() == true ? 0 : m_countNodes.back();
138  }
139 
140 private:
141  // Not implemented
142  Counter();
143  Counter(const Counter&);
144 };
145 
147 
149 XALAN_USES_MEMORY_MANAGER(CounterVectorTypeDecl)
150 
151 typedef XalanVector<CounterVectorTypeDecl> ElemCounterVectorVectorTypeDecl;
152 XALAN_USES_MEMORY_MANAGER(ElemCounterVectorVectorTypeDecl)
161 {
162 public:
163 
165 
166  typedef CounterVectorTypeDecl CounterVectorType;
167  typedef ElemCounterVectorVectorTypeDecl ElemCounterVectorVectorType;
168 
170 
175  unsigned long theSize = 0) :
176  m_countersVector(theManager),
177  m_newFound(theManager)
178  {
179  resize(theSize);
180  };
181 
183  {
184  }
185 
193  void
194  resize(unsigned long theSize)
195  {
196  m_countersVector.resize(theSize);
197  }
198 
208  CountType
209  countNode(
210  StylesheetExecutionContext& executionContext,
211  const ElemNumber& numberElem,
212  XalanNode* node);
213 
217  void
219  {
220  m_newFound.clear();
221 
222  m_countersVector.clear();
223  }
224 
225 private:
226  // not implemented
227  CountersTable();
228  CountersTable(const CountersTable&);
229 
233  ElemCounterVectorVectorType m_countersVector;
234 
235 
239  NodeVectorType m_newFound;
240 };
241 
242 
243 
244 XALAN_CPP_NAMESPACE_END
245 
246 
247 
248 #endif // !defined(XALAN_COUNTERSTABLE_HEADER_GUARD_1357924680)
ElemCounterVectorVectorTypeDecl ElemCounterVectorVectorType
Definition: CountersTable.hpp:167
NodeVectorType m_countNodes
A vector of all nodes counted so far.
Definition: CountersTable.hpp:73
Counter(MemoryManagerType &theManager, const ElemNumber *numberElem=0)
Construct a counter object.
Definition: CountersTable.hpp:104
Definition: XalanNode.hpp:44
Counter(const Counter &other, MemoryManagerType &theManager)
Definition: CountersTable.hpp:112
XALAN_CPP_NAMESPACE_BEGIN typedef XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager MemoryManagerType
Definition: XalanMemoryManagement.hpp:39
CountType m_countNodesStartCount
The start count from where m_countNodes counts from.
Definition: CountersTable.hpp:68
This is a table of counters, keyed by ElemNumber objects...
Definition: CountersTable.hpp:160
const ElemNumber * m_numberElem
The owning xsl:number element.
Definition: CountersTable.hpp:85
unsigned long CountType
Definition: CountersTable.hpp:58
A class that does incremental counting for support of xsl:numb...
Definition: CountersTable.hpp:56
CountType getPreviouslyCounted(StylesheetExecutionContext &support, const XalanNode *node) const
Try to find a node that was previously counted.
reference back()
Definition: XalanVector.hpp:673
Definition: StylesheetExecutionContext.hpp:104
CountersTable(MemoryManagerType &theManager, unsigned long theSize=0)
Construct a CountersTable.
Definition: CountersTable.hpp:174
void reset()
Clear all cached data from the table.
Definition: CountersTable.hpp:218
bool empty() const
Definition: XalanVector.hpp:636
XalanNode * getLast() const
Get the last node in the list.
Definition: CountersTable.hpp:135
CounterVectorTypeDecl CounterVectorType
Definition: CountersTable.hpp:166
~CountersTable()
Definition: CountersTable.hpp:182
Counter::NodeVectorType NodeVectorType
Definition: CountersTable.hpp:169
XalanVector< XalanNode * > NodeVectorType
Definition: CountersTable.hpp:60
#define XALAN_USES_MEMORY_MANAGER(Type)
Definition: XalanMemoryManagement.hpp:468
void resize(unsigned long theSize)
Resize the table.
Definition: CountersTable.hpp:194
Definition: ElemNumber.hpp:57
const XalanNode * m_fromNode
The node from where the counting starts.
Definition: CountersTable.hpp:80
Counter(MemoryManagerType &theManager, const ElemNumber *numberElem, NodeVectorType &countNodes)
Construct a counter object.
Definition: CountersTable.hpp:90
Counter::CountType CountType
Definition: CountersTable.hpp:164

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo