<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.4</h3> </BODY> <!-- Generated by Doxygen 1.1.2 on Mon Sep 16 08:29:00 2002 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</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>XPathProcessorImpl.hpp</h1><a href="XPathProcessorImpl.hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999-2002 The Apache Software Foundation. All rights 00006 * reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * 1. Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in 00017 * the documentation and/or other materials provided with the 00018 * distribution. 00019 * 00020 * 3. The end-user documentation included with the redistribution, 00021 * if any, must include the following acknowledgment: 00022 * "This product includes software developed by the 00023 * Apache Software Foundation (http://www.apache.org/)." 00024 * Alternately, this acknowledgment may appear in the software itself, 00025 * if and wherever such third-party acknowledgments normally appear. 00026 * 00027 * 4. The names "Xalan" and "Apache Software Foundation" must 00028 * not be used to endorse or promote products derived from this 00029 * software without prior written permission. For written 00030 * permission, please contact apache@apache.org. 00031 * 00032 * 5. Products derived from this software may not be called "Apache", 00033 * nor may "Apache" appear in their name, without prior written 00034 * permission of the Apache Software Foundation. 00035 * 00036 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00037 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00038 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00039 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00040 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00041 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00042 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00043 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00044 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00045 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00046 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00047 * SUCH DAMAGE. 00048 * ==================================================================== 00049 * 00050 * This software consists of voluntary contributions made by many 00051 * individuals on behalf of the Apache Software Foundation and was 00052 * originally based on software copyright (c) 1999, International 00053 * Business Machines, Inc., http://www.ibm.com. For more 00054 * information on the Apache Software Foundation, please see 00055 * <http://www.apache.org/>. 00056 */ 00057 #if !defined(XPATHPROCESSORIMPL_HEADER_GUARD_1357924680) <a name="l00058"><a class="code" href="XPathProcessorImpl.hpp.html#a0">00058</a></a> #define XPATHPROCESSORIMPL_HEADER_GUARD_1357924680 00059 00060 00061 00062 // Base header file. Must be first. 00063 #include <XPath/XPathDefinitions.hpp> 00064 00065 00066 00067 #include <cstdlib> 00068 #include <map> 00069 #include <vector> 00070 00071 00072 00073 #include <XalanDOM/XalanDOMString.hpp> 00074 00075 00076 00077 // Base class header file... 00078 #include <XPath/XPathProcessor.hpp> 00079 00080 00081 00082 #include <XPath/XPath.hpp> 00083 00084 00085 00086 class <a class="code" href="class_xalannode.html">XalanNode</a>; 00087 00088 00089 <a name="l00094"><a class="code" href="class_xpathprocessorimpl.html">00094</a></a> class XALAN_XPATH_EXPORT <a class="code" href="class_xpathprocessorimpl.html">XPathProcessorImpl</a> : public <a class="code" href="class_xpathprocessor.html">XPathProcessor</a> 00095 { 00096 public: 00097 00098 #if defined(XALAN_NO_NAMESPACES) 00099 typedef map<<a class="code" href="class_xalandomstring.html">XalanDOMString</a>, 00100 <a class="code" href="class_xalandomstring.html">XalanDOMString</a>, 00101 less<<a class="code" href="class_xalandomstring.html">XalanDOMString</a>> > StringToStringMapType; 00102 00103 typedef vector<bool> BoolVectorType; 00104 #else 00105 typedef std::map<<a class="code" href="class_xalandomstring.html">XalanDOMString</a>, <a name="l00106"><a class="code" href="class_xpathprocessorimpl.html#s0">00106</a></a> <a class="code" href="class_xalandomstring.html">XalanDOMString</a>> StringToStringMapType; 00107 <a name="l00108"><a class="code" href="class_xpathprocessorimpl.html#s1">00108</a></a> typedef std::vector<bool> BoolVectorType; 00109 #endif 00110 00111 <a class="code" href="class_xpathprocessorimpl.html#a0">XPathProcessorImpl</a>(); 00112 00113 virtual 00114 <a class="code" href="class_xpathprocessorimpl.html#a1">~XPathProcessorImpl</a>(); 00115 00116 00117 // These are inherited from XPathProcessor... 00118 00119 virtual void 00120 <a class="code" href="class_xpathprocessor.html#a2">initXPath</a>( 00121 <a class="code" href="class_xpath.html">XPath</a>& pathObj, 00122 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& expression, 00123 const <a class="code" href="class_prefixresolver.html">PrefixResolver</a>& prefixResolver, 00124 const <a class="code" href="class_locator.html">Locator</a>* locator = 0); 00125 00126 virtual void 00127 <a class="code" href="class_xpathprocessor.html#a3">initMatchPattern</a>( 00128 <a class="code" href="class_xpath.html">XPath</a>& pathObj, 00129 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& expression, 00130 const <a class="code" href="class_prefixresolver.html">PrefixResolver</a>& prefixResolver, 00131 const <a class="code" href="class_locator.html">Locator</a>* locator = 0); 00132 00133 private: 00134 00141 void 00142 tokenize(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& pat); 00143 00149 bool 00150 mapPatternElemPos( 00151 int nesting, 00152 bool isStart, 00153 bool isAttrName) const; 00154 00155 void 00156 addToTokenQueue(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& s) const; 00157 00158 void 00159 replaceTokenWithNamespaceToken() const; 00160 00165 int 00166 mapNSTokens( 00167 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& pat, 00168 int startSubstring, 00169 int posOfNSSep, 00170 int posOfScan); 00171 00175 int 00176 getTokenQueuePosFromMap(int i) const; 00177 00183 int 00184 getNextTargetIndexInMap(int i) const; 00185 00190 int 00191 getNextIndexInMap(int i) const; 00192 00199 int 00200 getNextSubpatternStartIndexInMap(int i) const; 00201 00207 int 00208 getNextPatternPos(int i) const; 00209 00215 int 00216 getPrevMapIndex(int i) const; 00217 00223 bool 00224 tokenIs(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& s) const; 00225 00231 bool 00232 tokenIs(const XalanDOMChar* s) const; 00233 00239 bool 00240 tokenIs(const char* s) const; 00241 00247 bool 00248 tokenIs(char c) const; 00249 00257 bool 00258 lookahead( 00259 XalanDOMChar c, 00260 int n) const; 00261 00269 bool 00270 lookahead( 00271 const XalanDOMChar* s, 00272 int n) const; 00273 00281 bool 00282 lookahead( 00283 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& s, 00284 int n) const; 00285 00296 bool 00297 lookbehind( 00298 char c, 00299 int n) const; 00300 00311 bool 00312 lookbehindHasToken(int n) const; 00313 00318 void 00319 nextToken(); 00320 00325 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& 00326 getTokenRelative(int theOffset) const; 00327 00332 void 00333 prevToken(); 00334 00339 void 00340 resetTokenMark(int mark); 00341 00346 void 00347 consumeExpected(const char* expected); 00348 00353 void 00354 consumeExpected(char expected); 00355 00356 bool 00357 isCurrentLiteral() const; 00358 00365 static bool 00366 isAxis(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& theToken); 00367 00374 static bool 00375 isNodeTest(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& theToken); 00376 00380 void 00381 error( 00382 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& msg, 00383 <a class="code" href="class_xalannode.html">XalanNode</a>* sourceNode = 0) const; 00384 00388 void 00389 error( 00390 const char* msg, 00391 <a class="code" href="class_xalannode.html">XalanNode</a>* sourceNode = 0) const; 00392 00396 static XPathExpression::eOpCodes 00397 getFunctionToken(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& key) 00398 { 00399 return searchTable(s_functionTable, s_functionTableSize, key).m_opCode; 00400 } 00401 00405 static XPathExpression::eOpCodes 00406 getNodeTypeToken(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& key) 00407 { 00408 return searchTable(s_nodeTypeTable, s_nodeTypeTableSize, key).m_opCode; 00409 } 00410 00414 static XPathExpression::eOpCodes 00415 getAxisToken(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& key) 00416 { 00417 return searchTable(s_axisTable, s_axisTableSize, key).m_opCode; 00418 } 00419 00426 void 00427 Expr(); 00428 00429 00437 void 00438 OrExpr(); 00439 00447 void 00448 AndExpr() ; 00449 00459 int 00460 EqualityExpr(int opCodePos = -1); 00461 00474 int 00475 RelationalExpr(int opCodePos = -1); 00476 00487 int 00488 AdditiveExpr(int opCodePos = -1); 00489 00502 int 00503 MultiplicativeExpr(int opCodePos = -1); 00504 00514 void 00515 UnaryExpr(); 00516 00523 void 00524 BooleanExpr(); 00525 00537 void 00538 UnionExpr(); 00539 00551 void 00552 PathExpr(); 00553 00563 void 00564 FilterExpr(); 00565 00575 void 00576 PrimaryExpr(); 00577 00578 00584 void 00585 Argument(); 00586 00592 void 00593 FunctionCall(); 00594 00601 void 00602 LocationPath(); 00603 00611 void 00612 RelativeLocationPath(); 00613 00619 void 00620 Step(); 00621 00627 void 00628 Basis(); 00629 00635 XPathExpression::eOpCodes 00636 AxisName(); 00637 00644 int 00645 NodeTest(XPathExpression::eOpCodes axisType); 00646 00652 void 00653 Predicate(); 00654 00660 void 00661 PredicateExpr(); 00662 00668 void 00669 QName(); 00670 00675 void 00676 NCName(); 00677 00686 void 00687 Literal(); 00688 00694 void 00695 Number(); 00696 00703 void 00704 Pattern(); 00705 00714 void 00715 LocationPathPattern(); 00716 00724 void 00725 IdKeyPattern(); 00726 00734 void 00735 RelativePathPattern(); 00736 00742 void 00743 StepPattern(); 00744 00750 void 00751 AbbreviatedNodeTestStep(); 00752 00753 static bool 00754 isValidFunction(const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& key); 00755 00756 private: 00757 00758 int 00759 FunctionCallArguments(); 00760 00761 struct TableEntry 00762 { 00763 const XalanDOMChar* m_string; 00764 00765 XPathExpression::eOpCodes m_opCode; 00766 }; 00767 00768 #if defined(XALAN_SIZE_T_IN_NAMESPACE_STD) 00769 typedef std::size_t size_type; 00770 #else 00771 typedef size_t size_type; 00772 #endif 00773 00774 static const TableEntry& 00775 searchTable( 00776 const TableEntry theTable[], 00777 size_type theTableSize, 00778 const <a class="code" href="class_xalandomstring.html">XalanDOMString</a>& theString); 00779 00783 <a class="code" href="class_xalandomstring.html">XalanDOMString</a> m_token; 00784 00790 XalanDOMChar m_tokenChar; 00791 00795 <a class="code" href="class_xpath.html">XPath</a>* m_xpath; 00796 00800 <a class="code" href="class_xpathexpression.html">XPathExpression</a>* m_expression; 00801 00805 const <a class="code" href="class_prefixresolver.html">PrefixResolver</a>* m_prefixResolver; 00806 00807 bool m_requireLiterals; 00808 00809 bool m_isMatchPattern; 00810 00811 const <a class="code" href="class_locator.html">Locator</a>* m_locator; 00812 00813 BoolVectorType m_positionPredicateStack; 00814 00815 StringToStringMapType m_namespaces; 00816 00817 enum eDummy 00818 { 00819 TARGETEXTRA = 10000 00820 }; 00821 00822 static const <a class="code" href="class_xalandomstring.html">XalanDOMString</a> s_emptyString; 00823 00824 static const XalanDOMChar s_functionIDString[]; 00825 00826 // This shouldn't really be here, since it's not part of the XPath standard, 00827 // but rather a part ofthe XSLT standard. 00828 static const XalanDOMChar s_functionKeyString[]; 00829 00830 static const XalanDOMChar s_orString[]; 00831 00832 static const XalanDOMChar s_andString[]; 00833 00834 static const XalanDOMChar s_divString[]; 00835 00836 static const XalanDOMChar s_modString[]; 00837 00838 static const XalanDOMChar s_dotString[]; 00839 00840 static const XalanDOMChar s_dotDotString[]; 00841 00842 static const XalanDOMChar s_axisString[]; 00843 00844 static const XalanDOMChar s_attributeString[]; 00845 00846 static const XalanDOMChar s_childString[]; 00847 00848 static const XalanDOMChar s_positionString[]; 00849 00850 static const XalanDOMChar s_asteriskString[]; 00851 00852 static const XalanDOMChar s_commentString[]; 00853 00854 static const XalanDOMChar s_piString[]; 00855 00856 static const XalanDOMChar s_nodeString[]; 00857 00858 static const XalanDOMChar s_textString[]; 00859 00860 static const XalanDOMChar s_ancestorString[]; 00861 00862 static const XalanDOMChar s_ancestorOrSelfString[]; 00863 00864 static const XalanDOMChar s_descendantString[]; 00865 00866 static const XalanDOMChar s_descendantOrSelfString[]; 00867 00868 static const XalanDOMChar s_followingString[]; 00869 00870 static const XalanDOMChar s_followingSiblingString[]; 00871 00872 static const XalanDOMChar s_parentString[]; 00873 00874 static const XalanDOMChar s_precedingString[]; 00875 00876 static const XalanDOMChar s_precedingSiblingString[]; 00877 00878 static const XalanDOMChar s_selfString[]; 00879 00880 static const XalanDOMChar s_namespaceString[]; 00881 00882 static const TableEntry s_functionTable[]; 00883 00884 static const size_type s_functionTableSize; 00885 00886 static const TableEntry s_nodeTypeTable[]; 00887 00888 static const size_type s_nodeTypeTableSize; 00889 00890 static const TableEntry s_axisTable[]; 00891 00892 static const size_type s_axisTableSize; 00893 00894 static const TableEntry s_dummyEntry; 00895 }; 00896 00897 00898 00899 #endif // XPATHPROCESSORIMPL_HEADER_GUARD_1357924680 </div></pre><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="images/dot.gif" width="1"></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.4</B><BR> Copyright © 2000, 2001, 2002 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"> </TD> </TR> </TABLE>