00001 /* 00002 * The Apache Software License, Version 1.1 00003 * 00004 * 00005 * Copyright (c) 1999 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(XPATH_HEADER_GUARD_1357924680) 00058 #define XPATH_HEADER_GUARD_1357924680 00059 00060 00061 00062 // Base header file. Must be first. 00063 #include <XPath/XPathDefinitions.hpp> 00064 00065 00066 00067 #include <XalanDOM/XalanDOMString.hpp> 00068 00069 00070 00071 // Base class header files... 00072 #include <XPath/XPathExecutionContext.hpp> 00073 00074 00075 00076 #include <XPath/XPathExpression.hpp> 00077 #include <XPath/Function.hpp> 00078 #include <XPath/XPathFunctionTable.hpp> 00079 00080 00081 00082 class PrefixResolver; 00083 class XLocator; 00084 class XObject; 00085 class XalanNode; 00086 00087 00088 00098 class XALAN_XPATH_EXPORT XPath 00099 { 00100 public: 00101 00102 static const XalanDOMString& PSEUDONAME_ANY; 00103 static const XalanDOMString& PSEUDONAME_ROOT; 00104 static const XalanDOMString& PSEUDONAME_TEXT; 00105 static const XalanDOMString& PSEUDONAME_COMMENT; 00106 static const XalanDOMString& PSEUDONAME_PI; 00107 static const XalanDOMString& PSEUDONAME_OTHER; 00108 00109 #if defined(XALAN_NO_NAMESPACES) 00110 typedef vector<XalanDOMString> TargetElementStringsVectorType; 00111 #else 00112 typedef std::vector<XalanDOMString> TargetElementStringsVectorType; 00113 #endif 00114 00115 00119 static void 00120 initialize(); 00121 00125 static void 00126 terminate(); 00127 00134 explicit 00135 XPath(bool createDefaultLocator = true); 00136 00137 virtual 00138 ~XPath(); 00139 00143 virtual void 00144 shrink(); 00145 00154 virtual const XObject* 00155 execute( 00156 XalanNode* context, 00157 const PrefixResolver& prefixResolver, 00158 XPathExecutionContext& executionContext) const; 00159 00169 virtual const XObject* 00170 execute( 00171 XalanNode* context, 00172 const PrefixResolver& prefixResolver, 00173 const NodeRefListBase& contextNodeList, 00174 XPathExecutionContext& executionContext) const; 00175 00184 virtual const XObject* 00185 execute(XPathExecutionContext& executionContext) const; 00186 00195 virtual const XObject* 00196 executeMore( 00197 XalanNode* context, 00198 int opPos, 00199 XPathExecutionContext& executionContext) const; 00200 00209 virtual const XObject* 00210 locationPath( 00211 XalanNode* context, 00212 int opPos, 00213 XPathExecutionContext& executionContext) const; 00214 00220 XPathExpression& 00221 getExpression() 00222 { 00223 return m_expression; 00224 } 00225 00231 const XPathExpression& 00232 getExpression() const 00233 { 00234 return m_expression; 00235 } 00236 00237 #if defined(XALAN_INLINE_INITIALIZATION) 00241 const double s_MatchScoreNone = -9999999999999.0; 00242 00247 const double s_MatchScoreQName = 0.0; 00248 00252 const double s_MatchScoreNSWild = -0.25; 00253 00257 const double s_MatchScoreNodeTest = -0.5; 00258 00263 const double s_MatchScoreOther = 0.5; 00264 #else 00268 static const double s_MatchScoreNone; 00269 00274 static const double s_MatchScoreQName; 00275 00279 static const double s_MatchScoreNSWild; 00280 00284 static const double s_MatchScoreNodeTest; 00285 00290 static const double s_MatchScoreOther; 00291 #endif 00292 00300 virtual double 00301 getMatchScore( 00302 XalanNode* context, 00303 const PrefixResolver& resolver, 00304 XPathExecutionContext& executionContext) const; 00305 00318 virtual double 00319 nodeTest( 00320 XalanNode* context, 00321 int opPos, 00322 int argLen, 00323 int stepType, 00324 XPathExecutionContext& executionContext) const; 00325 00334 virtual const XObject* 00335 predicate( 00336 XalanNode* context, 00337 int opPos, 00338 XPathExecutionContext& executionContext) const; 00339 00345 virtual void 00346 getTargetElementStrings(TargetElementStringsVectorType& targetStrings) const; 00347 00354 static void 00355 installFunction( 00356 const XalanDOMString& funcName, 00357 const Function& func); 00358 00365 static bool 00366 uninstallFunction(const XalanDOMString& funcName); 00367 00374 static bool 00375 isInstalledFunction(const XalanDOMString& theFunctionName) 00376 { 00377 return s_functions.isInstalledFunction(theFunctionName); 00378 } 00379 00380 typedef XPathFunctionTable FunctionTableType; 00381 00387 static const FunctionTableType& 00388 getFunctionTable() 00389 { 00390 return s_functions; 00391 } 00392 00393 #if defined(XALAN_NO_MEMBER_TEMPLATES) 00394 typedef XPathFunctionTable::InstalledFunctionNameVectorType 00395 InstalledFunctionNameVectorType; 00396 00402 static void 00403 getInstalledFunctionNames(InstalledFunctionNameVectorType& theVector) 00404 { 00405 s_functions.getInstalledFunctionNames(theVector); 00406 } 00407 #else 00413 template<class OutputIteratorType> 00414 static void 00415 getInstalledFunctionNames(OutputIteratorType theIterator) 00416 { 00417 s_functions.getInstalledFunctionNames(theIterator); 00418 } 00419 #endif 00420 00421 static void 00422 destroyTable() 00423 { 00424 s_functions.DestroyTable(); 00425 } 00426 protected: 00427 00431 virtual XLocator* 00432 createXLocatorHandler() const; 00433 00440 virtual const XObject* 00441 xpath( 00442 XalanNode* context, 00443 int opPos, 00444 XPathExecutionContext& executionContext) const; 00445 00452 virtual const XObject* 00453 matchPattern( 00454 XalanNode* context, 00455 int opPos, 00456 XPathExecutionContext& executionContext) const; 00457 00466 MutableNodeRefList* 00467 step( 00468 XalanNode* context, 00469 int opPos, 00470 XPathExecutionContext& executionContext) const; 00471 00472 protected: 00473 00480 const XObject* 00481 Or( 00482 XalanNode* context, 00483 int opPos, 00484 XPathExecutionContext& executionContext) const; 00485 00492 const XObject* 00493 And( 00494 XalanNode* context, 00495 int opPos, 00496 XPathExecutionContext& executionContext) const; 00497 00504 const XObject* 00505 notequals( 00506 XalanNode* context, 00507 int opPos, 00508 XPathExecutionContext& executionContext) const; 00509 00516 const XObject* 00517 equals( 00518 XalanNode* context, 00519 int opPos, 00520 XPathExecutionContext& executionContext) const; 00521 00528 const XObject* 00529 lte( 00530 XalanNode* context, 00531 int opPos, 00532 XPathExecutionContext& executionContext) const; 00533 00540 const XObject* 00541 lt( 00542 XalanNode* context, 00543 int opPos, 00544 XPathExecutionContext& executionContext) const; 00545 00552 const XObject* 00553 gte( 00554 XalanNode* context, 00555 int opPos, 00556 XPathExecutionContext& executionContext) const; 00557 00564 const XObject* 00565 gt( 00566 XalanNode* context, 00567 int opPos, 00568 XPathExecutionContext& executionContext) const; 00569 00576 const XObject* 00577 plus( 00578 XalanNode* context, 00579 int opPos, 00580 XPathExecutionContext& executionContext) const; 00581 00588 const XObject* 00589 minus( 00590 XalanNode* context, 00591 int opPos, 00592 XPathExecutionContext& executionContext) const; 00593 00600 const XObject* 00601 mult( 00602 XalanNode* context, 00603 int opPos, 00604 XPathExecutionContext& executionContext) const; 00605 00612 const XObject* 00613 div( 00614 XalanNode* context, 00615 int opPos, 00616 XPathExecutionContext& executionContext) const; 00617 00624 const XObject* 00625 mod( 00626 XalanNode* context, 00627 int opPos, 00628 XPathExecutionContext& executionContext) const; 00629 00637 const XObject* 00638 quo( 00639 XalanNode* context, 00640 int opPos, 00641 XPathExecutionContext& executionContext) const; 00642 00649 const XObject* 00650 neg( 00651 XalanNode* context, 00652 int opPos, 00653 XPathExecutionContext& executionContext) const; 00654 00661 const XObject* 00662 string( 00663 XalanNode* context, 00664 int opPos, 00665 XPathExecutionContext& executionContext) const; 00666 00673 const XObject* 00674 boolean( 00675 XalanNode* context, 00676 int opPos, 00677 XPathExecutionContext& executionContext) const; 00678 00685 const XObject* 00686 number( 00687 XalanNode* context, 00688 int opPos, 00689 XPathExecutionContext& executionContext) const; 00690 00697 const XObject* 00698 Union( 00699 XalanNode* context, 00700 int opPos, 00701 XPathExecutionContext& executionContext) const; 00702 00709 const XObject* 00710 literal( 00711 XalanNode* context, 00712 int opPos, 00713 XPathExecutionContext& executionContext) const; 00714 00721 const XObject* 00722 variable( 00723 XalanNode* context, 00724 int opPos, 00725 XPathExecutionContext& executionContext) const; 00726 00733 const XObject* 00734 group( 00735 XalanNode* context, 00736 int opPos, 00737 XPathExecutionContext& executionContext) const; 00738 00745 const XObject* 00746 numberlit( 00747 XalanNode* context, 00748 int opPos, 00749 XPathExecutionContext& executionContext) const; 00750 00757 const XObject* 00758 arg( 00759 XalanNode* context, 00760 int opPos, 00761 XPathExecutionContext& executionContext) const; 00762 00770 const XObject* 00771 locationPathPattern( 00772 XalanNode* context, 00773 int opPos, 00774 XPathExecutionContext& executionContext) const; 00775 00779 const XObject* 00780 runExtFunction( 00781 XalanNode* context, 00782 int opPos, 00783 XPathExecutionContext& executionContext) const; 00784 00788 const XObject* 00789 extfunction( 00790 XalanNode* context, 00791 int opPos, 00792 const XalanDOMString& theNamespace, 00793 const XalanDOMString& functionName, 00794 const Function::XObjectArgVectorType& argVec, 00795 XPathExecutionContext& executionContext) const; 00796 00800 const XObject* 00801 runFunction( 00802 XalanNode* context, 00803 int opPos, 00804 XPathExecutionContext& executionContext) const; 00805 00809 const XObject* 00810 function( 00811 XalanNode* context, 00812 int opPos, 00813 int funcID, 00814 const Function::XObjectArgVectorType& argVec, 00815 XPathExecutionContext& executionContext) const; 00816 00817 private: 00818 00819 // These are not implemented... 00820 XPath(const XPath&); 00821 00822 XPath& 00823 operator=(const XPath&); 00824 00825 bool 00826 operator==(const XPath&) const; 00827 00828 // Default vector allocation sizes. 00829 enum 00830 { 00831 eDefaultTargetStringsSize = 5, 00832 eDefaultArgVectorSize = 5 // for function call parameters 00833 }; 00834 00835 // Data members... 00836 00843 XLocator* m_defaultXLocator; 00844 00850 XPathExpression m_expression; 00851 00857 static FunctionTableType s_functions; 00858 }; 00859 00860 00861 00862 #endif // XPATH_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSL Transformer Version 1.0 |
|