Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

NodeSorter.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_NODESORTER_HEADER_GUARD)
17 #define XALAN_NODESORTER_HEADER_GUARD
18 
25 // Base include file. Must be first.
26 #include "XSLTDefinitions.hpp"
27 
28 
29 
30 #include <functional>
31 
32 
33 
35 
36 
37 
38 #include <xalanc/XPath/XObject.hpp>
39 
40 
41 
43 
44 
45 
46 XALAN_CPP_NAMESPACE_BEGIN
47 
48 
49 
50 class MutableNodeRefList;
52 class XalanNode;
53 class XPath;
54 
55 
58 
60 XALAN_USES_MEMORY_MANAGER(StringVectorTypeDecl)
61 
62 
67 {
68 public:
69 
71  {
72  public:
73 
75  XalanNode* theNode = 0,
76  unsigned int thePosition = 0) :
77  m_node(theNode),
78  m_position(thePosition)
79  {
80  }
81 
83  unsigned int m_position;
84  };
85 
88 
89  explicit
90  NodeSorter(MemoryManagerType& theManager);
91 
92  ~NodeSorter();
93 
94  NodeSortKeyVectorType&
96  {
97  return m_keys;
98  }
99 
107  void
108  sort(
109  StylesheetExecutionContext& executionContext,
110  MutableNodeRefList& theList);
111 
115 #if defined(XALAN_NO_STD_NAMESPACE)
116  struct XALAN_XSLT_EXPORT NodeSortKeyCompare : public binary_function<const NodeVectorType::value_type&, const NodeVectorType::value_type&, bool>
117 #else
118  struct XALAN_XSLT_EXPORT NodeSortKeyCompare : public std::binary_function<const NodeVectorType::value_type&, const NodeVectorType::value_type&, bool>
119 #endif
120  {
121  public:
122 
131  StylesheetExecutionContext& executionContext,
132  NodeSorter& theSorter,
133  const NodeVectorType& theNodes,
134  const NodeSortKeyVectorType& theNodeSortKeys) :
135  m_executionContext(executionContext),
136  m_sorter(theSorter),
137  m_nodes(theNodes),
138  m_nodeSortKeys(theNodeSortKeys)
139  {
140  }
141 
151  int
152  compare(
153  first_argument_type theLHS,
154  second_argument_type theRHS,
155  unsigned int theKeyIndex = 0) const;
156 
165  result_type
167  first_argument_type theLHS,
168  second_argument_type theRHS,
169  unsigned int theKeyIndex = 0) const
170  {
171  return compare(theLHS, theRHS, theKeyIndex) < 0 ? true : false;
172  }
173 
174  protected:
175 
176  double
178  const NodeSortKey& theKey,
179  unsigned int theKeyIndex,
180  first_argument_type theEntry) const;
181 
182  const XalanDOMString&
184  const NodeSortKey& theKey,
185  unsigned int theKeyIndex,
186  first_argument_type theEntry) const;
187 
188  private:
189 
190  StylesheetExecutionContext& m_executionContext;
191  NodeSorter& m_sorter;
192  const NodeVectorType& m_nodes;
193  const NodeSortKeyVectorType& m_nodeSortKeys;
194  };
195 
196  friend struct NodeSortKeyCompare;
197 
200  typedef StringVectorTypeDecl StringVectorType;
201 
205 
206  typedef NumberCacheType NumberResultsCacheType;
207 
208 #if defined(XALAN_NODESORTER_CACHE_XOBJECTS)
209  typedef XObjectCacheType StringResultsCacheType;
210 #else
211  typedef StringCacheType StringResultsCacheType;
212 #endif
213 
214 private:
215 
222  void
223  sort(StylesheetExecutionContext& executionContext);
224 
225  // Data members...
226  NumberResultsCacheType m_numberResultsCache;
227 
228  StringResultsCacheType m_stringResultsCache;
229 
230  NodeSortKeyVectorType m_keys;
231 
232  NodeVectorType m_scratchVector;
233 };
234 
235 
236 
237 XALAN_CPP_NAMESPACE_END
238 
239 
240 
241 #endif // XALAN_NODESORTER_HEADER_GUARD

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