blob: 5c8b239d09bb4fdf881f00974bb6cba8fae3d304 [file] [log] [blame]
<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> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; </center>
<hr><h1>NodeSorter.hpp</h1><a href="NodeSorter_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 <font class="preprocessor">#if !defined(XALAN_NODESORTER_HEADER_GUARD)</font>
<a name="l00017"></a><a class="code" href="NodeSorter_8hpp.html#a0">00017</a> <font class="preprocessor"></font><font class="preprocessor">#define XALAN_NODESORTER_HEADER_GUARD</font>
00018 <font class="preprocessor"></font>
00022
00023
00024
00025 <font class="comment">// Base include file. Must be first.</font>
00026 <font class="preprocessor">#include "<a class="code" href="XSLTDefinitions_8hpp.html">XSLTDefinitions.hpp</a>"</font>
00027
00028
00029
00030 <font class="preprocessor">#include &lt;functional&gt;</font>
00031
00032
00033
00034 <font class="preprocessor">#include &lt;<a class="code" href="XalanVector_8hpp.html">xalanc/Include/XalanVector.hpp</a>&gt;</font>
00035
00036
00037
00038 <font class="preprocessor">#include &lt;<a class="code" href="XObject_8hpp.html">xalanc/XPath/XObject.hpp</a>&gt;</font>
00039
00040
00041
00042 <font class="preprocessor">#include &lt;<a class="code" href="NodeSortKey_8hpp.html">xalanc/XSLT/NodeSortKey.hpp</a>&gt;</font>
00043
00044
00045
00046 XALAN_CPP_NAMESPACE_BEGIN
00047
00048
00049
<a name="l00050"></a><a class="code" href="NodeSorter_8hpp.html#a1">00050</a> <font class="keyword">class </font><a class="code" href="classMutableNodeRefList.html">MutableNodeRefList</a>;
00051 <font class="keyword">class </font><a class="code" href="classStylesheetExecutionContext.html">StylesheetExecutionContext</a>;
00052 <font class="keyword">class </font><a class="code" href="classXalanNode.html">XalanNode</a>;
00053 <font class="keyword">class </font><a class="code" href="classXPath.html">XPath</a>;
00054
00055
<a name="l00056"></a><a class="code" href="NodeSorter_8hpp.html#a2">00056</a> <font class="keyword">typedef</font> XalanVector&lt;double&gt; NumberVectorTypeDecl;
00057 <a class="code" href="XalanMemoryManagement_8hpp.html#a4">XALAN_USES_MEMORY_MANAGER</a>(NumberVectorTypeDecl)
00058
00059 <font class="keyword">typedef</font> XalanVector&lt;XalanDOMString&gt; StringVectorTypeDecl;
<a name="l00060"></a><a class="code" href="NodeSorter_8hpp.html#a4">00060</a> <a class="code" href="XalanMemoryManagement_8hpp.html#a4">XALAN_USES_MEMORY_MANAGER</a>(StringVectorTypeDecl)
00061
00062
00066 <font class="keyword">class </font>XALAN_XSLT_EXPORT NodeSorter
00067 {
00068 <font class="keyword">public</font>:
00069
00070 <font class="keyword">struct </font>XALAN_XSLT_EXPORT VectorEntry
00071 {
00072 <font class="keyword">public</font>:
00073
00074 VectorEntry(
00075 <a class="code" href="classXalanNode.html">XalanNode</a>* theNode = 0,
00076 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> thePosition = 0) :
00077 m_node(theNode),
00078 m_position(thePosition)<font class="keyword"></font>
00079 <font class="keyword"> </font>{
00080 }
00081
00082 <a class="code" href="classXalanNode.html">XalanNode</a>* m_node;
00083 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> m_position;
00084 };
00085
00086 <font class="keyword">typedef</font> XalanVector&lt;VectorEntry&gt; NodeVectorType;
00087 <font class="keyword">typedef</font> XalanVector&lt;NodeSortKey&gt; NodeSortKeyVectorType;
00088
00089 <font class="keyword">explicit</font>
00090 NodeSorter(MemoryManagerType&amp; theManager);
00091
00092 ~NodeSorter();
00093
00094 NodeSortKeyVectorType&amp;
00095 getSortKeys()<font class="keyword"></font>
00096 <font class="keyword"> </font>{
00097 <font class="keywordflow">return</font> m_keys;
00098 }
00099
00107 <font class="keywordtype">void</font>
00108 sort(
00109 <a class="code" href="classStylesheetExecutionContext.html">StylesheetExecutionContext</a>&amp; executionContext,
00110 <a class="code" href="classMutableNodeRefList.html">MutableNodeRefList</a>&amp; theList);
00111
00115 <font class="preprocessor">#if defined(XALAN_NO_STD_NAMESPACE)</font>
00116 <font class="preprocessor"></font> <font class="keyword">struct </font>XALAN_XSLT_EXPORT NodeSortKeyCompare : <font class="keyword">public</font> binary_function&lt;const NodeVectorType::value_type&amp;, const NodeVectorType::value_type&amp;, bool&gt;
00117 #else
00118 struct XALAN_XSLT_EXPORT NodeSortKeyCompare : <font class="keyword">public</font> std::binary_function&lt;const NodeVectorType::value_type&amp;, const NodeVectorType::value_type&amp;, bool&gt;
00119 #endif
00120 {
00121 <font class="keyword">public</font>:
00122
00130 NodeSortKeyCompare(
00131 <a class="code" href="classStylesheetExecutionContext.html">StylesheetExecutionContext</a>&amp; executionContext,
00132 NodeSorter&amp; theSorter,
00133 <font class="keyword">const</font> NodeVectorType&amp; theNodes,
00134 <font class="keyword">const</font> NodeSortKeyVectorType&amp; theNodeSortKeys) :
00135 m_executionContext(executionContext),
00136 m_sorter(theSorter),
00137 m_nodes(theNodes),
00138 m_nodeSortKeys(theNodeSortKeys)<font class="keyword"></font>
00139 <font class="keyword"> </font>{
00140 }
00141
00151 <font class="keywordtype">int</font>
00152 <a class="code" href="DOMStringHelper_8hpp.html#a53">compare</a>(
00153 first_argument_type theLHS,
00154 second_argument_type theRHS,
00155 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> theKeyIndex = 0) <font class="keyword">const</font>;
00156
00165 result_type
00166 operator()(
00167 first_argument_type theLHS,
00168 second_argument_type theRHS,
00169 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> theKeyIndex = 0)<font class="keyword"> const</font>
00170 <font class="keyword"> </font>{
00171 <font class="keywordflow">return</font> <a class="code" href="DOMStringHelper_8hpp.html#a53">compare</a>(theLHS, theRHS, theKeyIndex) &lt; 0 ? <font class="keyword">true</font> : <font class="keyword">false</font>;
00172 }
00173
00174 <font class="keyword">protected</font>:
00175
00176 <font class="keywordtype">double</font>
00177 getNumberResult(
00178 <font class="keyword">const</font> <a class="code" href="classNodeSortKey.html">NodeSortKey</a>&amp; theKey,
00179 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> theKeyIndex,
00180 first_argument_type theEntry) <font class="keyword">const</font>;
00181
00182 <font class="keyword">const</font> <a class="code" href="classXalanDOMString.html">XalanDOMString</a>&amp;
00183 getStringResult(
00184 <font class="keyword">const</font> <a class="code" href="classNodeSortKey.html">NodeSortKey</a>&amp; theKey,
00185 <font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> theKeyIndex,
00186 first_argument_type theEntry) <font class="keyword">const</font>;
00187
00188 <font class="keyword">private</font>:
00189
00190 <a class="code" href="classStylesheetExecutionContext.html">StylesheetExecutionContext</a>&amp; m_executionContext;
00191 NodeSorter&amp; m_sorter;
00192 <font class="keyword">const</font> NodeVectorType&amp; m_nodes;
00193 <font class="keyword">const</font> NodeSortKeyVectorType&amp; m_nodeSortKeys;
00194 };
00195
00196 <font class="keyword">friend</font> <font class="keyword">struct </font>NodeSortKeyCompare;
00197
00198 <font class="keyword">typedef</font> NumberVectorTypeDecl NumberVectorType;
00199 <font class="keyword">typedef</font> XalanVector&lt;XObjectPtr&gt; XObjectVectorType;
00200 <font class="keyword">typedef</font> StringVectorTypeDecl StringVectorType;
00201
00202 <font class="keyword">typedef</font> XalanVector&lt;NumberVectorType&gt; NumberCacheType;
00203 <font class="keyword">typedef</font> XalanVector&lt;XObjectVectorType&gt; XObjectCacheType;
00204 <font class="keyword">typedef</font> XalanVector&lt;StringVectorType&gt; StringCacheType;
00205
00206 <font class="keyword">typedef</font> NumberCacheType NumberResultsCacheType;
00207
00208 <font class="preprocessor">#if defined(XALAN_NODESORTER_CACHE_XOBJECTS)</font>
00209 <font class="preprocessor"></font> <font class="keyword">typedef</font> XObjectCacheType StringResultsCacheType;
00210 <font class="preprocessor">#else</font>
00211 <font class="preprocessor"></font> <font class="keyword">typedef</font> StringCacheType StringResultsCacheType;
00212 <font class="preprocessor">#endif</font>
00213 <font class="preprocessor"></font>
00214 <font class="keyword">private</font>:
00215
00222 <font class="keywordtype">void</font>
00223 sort(<a class="code" href="classStylesheetExecutionContext.html">StylesheetExecutionContext</a>&amp; executionContext);
00224
00225 <font class="comment">// Data members...</font>
00226 NumberResultsCacheType m_numberResultsCache;
00227
00228 StringResultsCacheType m_stringResultsCache;
00229
00230 NodeSortKeyVectorType m_keys;
00231
00232 NodeVectorType m_scratchVector;
00233 };
00234
00235
00236
00237 XALAN_CPP_NAMESPACE_END
00238
00239
00240
00241 <font class="preprocessor">#endif // XALAN_NODESORTER_HEADER_GUARD</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 &copy; 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>