00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XPATH_HEADER_GUARD_1357924680) 00019 #define XPATH_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base header file. Must be first. 00024 #include <xalanc/XPath/XPathDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00029 00030 00031 00032 #include <xalanc/PlatformSupport/DoubleSupport.hpp> 00033 00034 00035 00036 // Base class header files... 00037 #include <xalanc/XPath/XPathExecutionContext.hpp> 00038 00039 00040 00041 #include <xalanc/XPath/MutableNodeRefList.hpp> 00042 #include <xalanc/XPath/XPathExpression.hpp> 00043 #include <xalanc/XPath/Function.hpp> 00044 #include <xalanc/XPath/XPathFunctionTable.hpp> 00045 00046 00047 00048 XALAN_DECLARE_XERCES_CLASS(Locator) 00049 00050 00051 00052 XALAN_CPP_NAMESPACE_BEGIN 00053 00054 00055 00056 class PrefixResolver; 00057 class XObject; 00058 class XalanElement; 00059 class XalanNode; 00060 class XPathConstructionContext; 00061 00062 00063 00064 class XALAN_XPATH_EXPORT XPath 00065 { 00066 public: 00067 00068 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType; 00069 00070 typedef XPathExpression::OpCodeMapPositionType OpCodeMapPositionType; 00071 typedef XPathExpression::OpCodeMapValueType OpCodeMapValueType; 00072 typedef XPathExpression::TokenQueuePositionType TokenQueuePositionType; 00073 typedef XPathExecutionContext::GetCachedString GetCachedString; 00074 typedef XPathExecutionContext::PrefixResolverSetAndRestore PrefixResolverSetAndRestore; 00075 typedef XPathExecutionContext::CurrentNodePushAndPop CurrentNodePushAndPop; 00076 00077 00078 static const XalanDOMChar PSEUDONAME_ANY[]; 00079 static const XalanDOMChar PSEUDONAME_ROOT[]; 00080 static const XalanDOMChar PSEUDONAME_TEXT[]; 00081 static const XalanDOMChar PSEUDONAME_COMMENT[]; 00082 static const XalanDOMChar PSEUDONAME_PI[]; 00083 static const XalanDOMChar PSEUDONAME_OTHER[]; 00084 static const XalanDOMChar PSEUDONAME_NODE[]; 00085 00086 enum eMatchScore 00087 { 00088 eMatchScoreNone, 00089 eMatchScoreNodeTest, 00090 eMatchScoreNSWild, 00091 eMatchScoreQName, 00092 eMatchScoreOther 00093 }; 00094 00095 class TargetData 00096 { 00097 public: 00098 00099 enum eTargetType { eAttribute, eElement, eAny, eOther }; 00100 00101 TargetData() : 00102 m_string(0), 00103 m_priority(eMatchScoreNone), 00104 m_targetType(eOther) 00105 { 00106 } 00107 00108 TargetData( 00109 const XalanDOMChar* theString, 00110 eMatchScore thePriority, 00111 eTargetType theTargetType) : 00112 m_string(theString), 00113 m_priority(thePriority), 00114 m_targetType(theTargetType) 00115 { 00116 } 00117 00118 const XalanDOMChar* 00119 getString() const 00120 { 00121 return m_string; 00122 } 00123 00124 eMatchScore 00125 getDefaultPriority() const 00126 { 00127 return m_priority; 00128 } 00129 00130 eTargetType 00131 getTargetType() const 00132 { 00133 return m_targetType; 00134 } 00135 00136 private: 00137 00138 const XalanDOMChar* m_string; 00139 00140 eMatchScore m_priority; 00141 00142 eTargetType m_targetType; 00143 }; 00144 00145 typedef XalanVector<TargetData> TargetDataVectorType; 00146 00147 /** 00148 * Perform static initialization. See class XPathInit. 00149 */ 00150 static void 00151 initialize(MemoryManager& theManager); 00152 00153 /** 00154 * Perform static shut down. See class XPathInit. 00155 */ 00156 static void 00157 terminate(); 00158 00159 /** 00160 * Construct an XPath. 00161 * 00162 * @param theLocator The applicable Locator, if any. 00163 */ 00164 explicit 00165 XPath( 00166 MemoryManager& theManager, 00167 const Locator* theLocator = 0); 00168 00169 static XPath* 00170 create( 00171 MemoryManager& theManager, 00172 const Locator* theLocator = 0); 00173 00174 MemoryManager& 00175 getMemoryManager() 00176 { 00177 return m_expression.getMemoryManager(); 00178 } 00179 00180 ~XPath(); 00181 00182 /** 00183 * Shrink internal tables. 00184 */ 00185 void 00186 shrink() 00187 { 00188 m_expression.shrink(); 00189 } 00190 00191 /** 00192 * Execute the XPath from the provided context. 00193 * 00194 * @param context current source tree context node, which must not be 0 00195 * @param prefixResolver prefix resolver to use 00196 * @param executionContext current execution context 00197 * @return smart-pointer to result XObject 00198 */ 00199 const XObjectPtr 00200 execute( 00201 XalanNode* context, 00202 const PrefixResolver& prefixResolver, 00203 XPathExecutionContext& executionContext) const; 00204 00205 /** 00206 * Execute the XPath from the provided context. 00207 * 00208 * @param context current source tree context node, which must not be 0 00209 * @param prefixResolver prefix resolver to use 00210 * @param executionContext current execution context 00211 * @param result the boolean result 00212 */ 00213 void 00214 execute( 00215 XalanNode* context, 00216 const PrefixResolver& prefixResolver, 00217 XPathExecutionContext& executionContext, 00218 bool& result) const; 00219 00220 /** 00221 * Execute the XPath from the provided context. 00222 * 00223 * @param context current source tree context node, which must not be 0 00224 * @param prefixResolver prefix resolver to use 00225 * @param executionContext current execution context 00226 * @param result the numeric result 00227 */ 00228 void 00229 execute( 00230 XalanNode* context, 00231 const PrefixResolver& prefixResolver, 00232 XPathExecutionContext& executionContext, 00233 double& result) const; 00234 00235 /** 00236 * Execute the XPath from the provided context. The 00237 * result is appended to the supplied string. 00238 * 00239 * @param context current source tree context node, which must not be 0 00240 * @param prefixResolver prefix resolver to use 00241 * @param executionContext current execution context 00242 * @param result the string result 00243 */ 00244 void 00245 execute( 00246 XalanNode* context, 00247 const PrefixResolver& prefixResolver, 00248 XPathExecutionContext& executionContext, 00249 XalanDOMString& result) const; 00250 00251 typedef void (FormatterListener::*MemberFunctionPtr)(const XMLCh* const, const FormatterListener::size_type); 00252 00253 /** 00254 * Execute the XPath from the provided context. 00255 * 00256 * @param context current source tree context node, which must not be 0 00257 * @param prefixResolver prefix resolver to use 00258 * @param executionContext current execution context 00259 * @param formatterListener the FormatterListener instance to receive the result 00260 * @param function A pointer to the member function of FormatterListener to call 00261 */ 00262 void 00263 execute( 00264 XalanNode* context, 00265 const PrefixResolver& prefixResolver, 00266 XPathExecutionContext& executionContext, 00267 FormatterListener& formatterListener, 00268 MemberFunctionPtr function) const; 00269 00270 /** 00271 * Execute the XPath from the provided context. Normally, 00272 * the expression will be evaluated and the result placed 00273 * in the parameter result. However, some cases (such as 00274 * the evalution of a variable) could result in the copying 00275 * of a node-set, which is extremely expensive. In that 00276 * case, the return value will contain the result of the 00277 * evaluation. If the call to XObject::null() on the return 00278 * value is true, that indicates the value was executed 00279 * directly into the parameter. Otherwise, the parameter 00280 * will be empty, and the result will be in the XObject 00281 * instance returned. 00282 * 00283 * @param context current source tree context node, which must not be 0 00284 * @param prefixResolver prefix resolver to use 00285 * @param executionContext current execution context 00286 * @param result the node-set result 00287 * @return the node-set result, if the result was not returned in the parameter 00288 */ 00289 const XObjectPtr 00290 execute( 00291 XalanNode* context, 00292 const PrefixResolver& prefixResolver, 00293 XPathExecutionContext& executionContext, 00294 MutableNodeRefList& result) const; 00295 00296 /** 00297 * Execute the XPath from the provided context. 00298 * 00299 * @param context current source tree context node, which must not be 0 00300 * @param prefixResolver prefix resolver to use 00301 * @param contextNodeList node list for current context 00302 * @param executionContext current execution context 00303 * @return smart-pointer to result XObject 00304 */ 00305 const XObjectPtr 00306 execute( 00307 XalanNode* context, 00308 const PrefixResolver& prefixResolver, 00309 const NodeRefListBase& contextNodeList, 00310 XPathExecutionContext& executionContext) const 00311 { 00312 // Push and pop the context node list... 00313 XPathExecutionContext::ContextNodeListPushAndPop thePushAndPop( 00314 executionContext, 00315 contextNodeList); 00316 00317 return execute(context, prefixResolver, executionContext); 00318 } 00319 00320 /** 00321 * Execute the XPath from the provided context. 00322 * 00323 * @param context current source tree context node, which must not be 0 00324 * @param prefixResolver prefix resolver to use 00325 * @param contextNodeList node list for current context 00326 * @param executionContext current execution context 00327 * @param result the boolean result 00328 */ 00329 void 00330 execute( 00331 XalanNode* context, 00332 const PrefixResolver& prefixResolver, 00333 const NodeRefListBase& contextNodeList, 00334 XPathExecutionContext& executionContext, 00335 bool& result) const 00336 { 00337 // Push and pop the context node list... 00338 XPathExecutionContext::ContextNodeListPushAndPop thePushAndPop( 00339 executionContext, 00340 contextNodeList); 00341 00342 execute(context, prefixResolver, executionContext, result); 00343 } 00344 00345 /** 00346 * Execute the XPath from the provided context. 00347 * 00348 * @param context current source tree context node, which must not be 0 00349 * @param prefixResolver prefix resolver to use 00350 * @param contextNodeList node list for current context 00351 * @param executionContext current execution context 00352 * @param result the numeric result 00353 */ 00354 void 00355 execute( 00356 XalanNode* context, 00357 const PrefixResolver& prefixResolver, 00358 const NodeRefListBase& contextNodeList, 00359 XPathExecutionContext& executionContext, 00360 double& result) const 00361 { 00362 // Push and pop the context node list... 00363 XPathExecutionContext::ContextNodeListPushAndPop thePushAndPop( 00364 executionContext, 00365 contextNodeList); 00366 00367 execute(context, prefixResolver, executionContext, result); 00368 } 00369 00370 /** 00371 * Execute the XPath from the provided context. The 00372 * result is appended to the supplied string. 00373 * 00374 * @param context current source tree context node, which must not be 0 00375 * @param prefixResolver prefix resolver to use 00376 * @param contextNodeList node list for current context 00377 * @param executionContext current execution context 00378 * @param result the string result 00379 */ 00380 void 00381 execute( 00382 XalanNode* context, 00383 const PrefixResolver& prefixResolver, 00384 const NodeRefListBase& contextNodeList, 00385 XPathExecutionContext& executionContext, 00386 XalanDOMString& result) const 00387 { 00388 // Push and pop the context node list... 00389 XPathExecutionContext::ContextNodeListPushAndPop thePushAndPop( 00390 executionContext, 00391 contextNodeList); 00392 00393 execute(context, prefixResolver, executionContext, result); 00394 } 00395 00396 /** 00397 * Execute the XPath from the provided context. 00398 * 00399 * @param context current source tree context node, which must not be 0 00400 * @param prefixResolver prefix resolver to use 00401 * @param contextNodeList node list for current context 00402 * @param executionContext current execution context 00403 * @param formatterListener the FormatterListener instance to receive the result 00404 * @param function A pointer to the member function of FormatterListener to call 00405 */ 00406 void 00407 execute( 00408 XalanNode* context, 00409 const PrefixResolver& prefixResolver, 00410 const NodeRefListBase& contextNodeList, 00411 XPathExecutionContext& executionContext, 00412 FormatterListener& formatterListener, 00413 MemberFunctionPtr function) const 00414 { 00415 // Push and pop the context node list... 00416 XPathExecutionContext::ContextNodeListPushAndPop thePushAndPop( 00417 executionContext, 00418 contextNodeList); 00419 00420 execute(context, prefixResolver, executionContext, formatterListener, function); 00421 } 00422 00423 /** 00424 * Execute the XPath from the provided context. Normally, 00425 * the expression will be evaluated and the result placed 00426 * in the parameter result. However, some cases (such as 00427 * the evalution of a variable) could result in the copying 00428 * of a node-set, which is extremely expensive. In that 00429 * case, the return value will contain the result of the 00430 * evaluation. If the call to XObject::null() on the return 00431 * value is true, that indicates the value was executed 00432 * directly into the parameter. Otherwise, the parameter 00433 * will be empty, and the result will be in the XObject 00434 * instance returned. 00435 * 00436 * @param context current source tree context node, which must not be 0 00437 * @param prefixResolver prefix resolver to use 00438 * @param contextNodeList node list for current context 00439 * @param executionContext current execution context 00440 * @param result the result as a set of nodes 00441 * @return the node-set result, if the result was not returned in the parameter 00442 */ 00443 const XObjectPtr 00444 execute( 00445 XalanNode* context, 00446 const PrefixResolver& prefixResolver, 00447 const NodeRefListBase& contextNodeList, 00448 XPathExecutionContext& executionContext, 00449 MutableNodeRefList& result) const 00450 { 00451 // Push and pop the context node list... 00452 XPathExecutionContext::ContextNodeListPushAndPop thePushAndPop( 00453 executionContext, 00454 contextNodeList); 00455 00456 return execute(context, prefixResolver, executionContext, result); 00457 } 00458 00459 /** 00460 * Execute the XPath from the provided context. 00461 * 00462 * The prefix resolver and current node must already 00463 * be set execution context, and must not be 0. 00464 * 00465 * @param executionContext current execution context 00466 * @return smart-pointer to result XObject 00467 */ 00468 const XObjectPtr 00469 execute(XPathExecutionContext& executionContext) const 00470 { 00471 assert(executionContext.getCurrentNode() != 0); 00472 assert(executionContext.getPrefixResolver() != 0); 00473 00474 return executeMore( 00475 executionContext.getCurrentNode(), 00476 getInitialOpCodePosition(), 00477 executionContext); 00478 } 00479 00480 /** 00481 * Execute the XPath from the provided context. 00482 * 00483 * The prefix resolver and current node must already 00484 * be set execution context, and must not be 0. 00485 * 00486 * @param executionContext current execution context 00487 * @param result the boolean result 00488 */ 00489 void 00490 execute( 00491 XPathExecutionContext& executionContext, 00492 bool& result) const 00493 { 00494 assert(executionContext.getCurrentNode() != 0); 00495 assert(executionContext.getPrefixResolver() != 0); 00496 00497 executeMore( 00498 executionContext.getCurrentNode(), 00499 getInitialOpCodePosition(), 00500 executionContext, 00501 result); 00502 } 00503 00504 /** 00505 * Execute the XPath from the provided context. 00506 * 00507 * The prefix resolver must already be set in the 00508 * execution context. 00509 * 00510 * @param executionContext current execution context 00511 * @param result the numeric result 00512 */ 00513 void 00514 execute( 00515 XPathExecutionContext& executionContext, 00516 double& result) const 00517 { 00518 assert(executionContext.getCurrentNode() != 0); 00519 assert(executionContext.getPrefixResolver() != 0); 00520 00521 executeMore( 00522 executionContext.getCurrentNode(), 00523 getInitialOpCodePosition(), 00524 executionContext, 00525 result); 00526 } 00527 00528 /** 00529 * Execute the XPath from the provided context. The 00530 * result is appended to the supplied string. 00531 * 00532 * The prefix resolver and current node must already 00533 * be set execution context, and must not be 0. 00534 * 00535 * @param executionContext current execution context 00536 * @param result the string result 00537 */ 00538 void 00539 execute( 00540 XPathExecutionContext& executionContext, 00541 XalanDOMString& result) const 00542 { 00543 assert(executionContext.getCurrentNode() != 0); 00544 assert(executionContext.getPrefixResolver() != 0); 00545 00546 executeMore( 00547 executionContext.getCurrentNode(), 00548 getInitialOpCodePosition(), 00549 executionContext, 00550 result); 00551 } 00552 00553 /** 00554 * Execute the XPath from the provided context. 00555 * 00556 * The prefix resolver and current node must already 00557 * be set execution context, and must not be 0. 00558 * 00559 * @param executionContext current execution context 00560 * @param formatterListener the FormatterListener instance to receive the result 00561 * @param function A pointer to the member function of FormatterListener to call 00562 */ 00563 void 00564 execute( 00565 XPathExecutionContext& executionContext, 00566 FormatterListener& formatterListener, 00567 MemberFunctionPtr function) const 00568 { 00569 assert(executionContext.getCurrentNode() != 0); 00570 assert(executionContext.getPrefixResolver() != 0); 00571 00572 executeMore( 00573 executionContext.getCurrentNode(), 00574 getInitialOpCodePosition(), 00575 executionContext, 00576 formatterListener, 00577 function); 00578 } 00579 00580 /** 00581 * Execute the XPath from the provided context. Normally, 00582 * the expression will be evaluated and the result placed 00583 * in the parameter result. However, some cases (such as 00584 * the evalution of a variable) could result in the copying 00585 * of a node-set, which is extremely expensive. In that 00586 * case, the return value will contain the result of the 00587 * evaluation. If the call to XObject::null() on the return 00588 * value is true, that indicates the value was executed 00589 * directly into the parameter. Otherwise, the parameter 00590 * will be empty, and the result will be in the XObject 00591 * instance returned. 00592 * 00593 * The prefix resolver and current node must already 00594 * be set execution context, and must not be 0. 00595 * 00596 * @param executionContext current execution context 00597 * @param result A node list for the result. This may or may not contain the actual result. 00598 * @return the node-set result, if the result was not returned in the parameter 00599 */ 00600 const XObjectPtr 00601 execute( 00602 XPathExecutionContext& executionContext, 00603 MutableNodeRefList& result) const 00604 { 00605 assert(executionContext.getCurrentNode() != 0); 00606 assert(executionContext.getPrefixResolver() != 0); 00607 00608 return executeMore( 00609 executionContext.getCurrentNode(), 00610 getInitialOpCodePosition(), 00611 executionContext, 00612 result); 00613 } 00614 00615 /** 00616 * Execute the XPath from the provided context. 00617 * 00618 * The current node must already be set execution context, 00619 * and must not be 0. 00620 * 00621 * @param executionContext current execution context 00622 * @param prefixResolver prefix resolver to use 00623 * @return smart-pointer to result XObject 00624 */ 00625 const XObjectPtr 00626 execute( 00627 const PrefixResolver& prefixResolver, 00628 XPathExecutionContext& executionContext) const 00629 { 00630 assert(executionContext.getCurrentNode() != 0); 00631 00632 // Push and pop the PrefixResolver... 00633 const PrefixResolverSetAndRestore theResolverSetAndRestore( 00634 executionContext, 00635 &prefixResolver); 00636 00637 return executeMore( 00638 executionContext.getCurrentNode(), 00639 getInitialOpCodePosition(), 00640 executionContext); 00641 } 00642 00643 /** 00644 * Execute the XPath from the provided context. 00645 * 00646 * The current node must already be set execution context, 00647 * and must not be 0. 00648 * 00649 * @param executionContext current execution context 00650 * @param prefixResolver prefix resolver to use 00651 * @param result the boolean result 00652 */ 00653 void 00654 execute( 00655 const PrefixResolver& prefixResolver, 00656 XPathExecutionContext& executionContext, 00657 bool& result) const 00658 { 00659 assert(executionContext.getCurrentNode() != 0); 00660 00661 // Push and pop the PrefixResolver... 00662 const PrefixResolverSetAndRestore theResolverSetAndRestore( 00663 executionContext, 00664 &prefixResolver); 00665 00666 executeMore( 00667 executionContext.getCurrentNode(), 00668 getInitialOpCodePosition(), 00669 executionContext, 00670 result); 00671 } 00672 00673 /** 00674 * Execute the XPath from the provided context. 00675 * 00676 * The current node must already be set execution context, 00677 * and must not be 0. 00678 * 00679 * @param executionContext current execution context 00680 * @param prefixResolver prefix resolver to use 00681 * @param result the numeric result 00682 */ 00683 void 00684 execute( 00685 const PrefixResolver& prefixResolver, 00686 XPathExecutionContext& executionContext, 00687 double& result) const 00688 { 00689 assert(executionContext.getCurrentNode() != 0); 00690 00691 // Push and pop the PrefixResolver... 00692 const PrefixResolverSetAndRestore theResolverSetAndRestore( 00693 executionContext, 00694 &prefixResolver); 00695 00696 executeMore( 00697 executionContext.getCurrentNode(), 00698 getInitialOpCodePosition(), 00699 executionContext, 00700 result); 00701 } 00702 00703 /** 00704 * Execute the XPath from the provided context. The 00705 * result is appended to the supplied string. 00706 * 00707 * The current node must already be set execution context, 00708 * and must not be 0. 00709 * 00710 * @param executionContext current execution context 00711 * @param prefixResolver prefix resolver to use 00712 * @param result the string result 00713 */ 00714 void 00715 execute( 00716 const PrefixResolver& prefixResolver, 00717 XPathExecutionContext& executionContext, 00718 XalanDOMString& result) const 00719 { 00720 assert(executionContext.getCurrentNode() != 0); 00721 00722 // Push and pop the PrefixResolver... 00723 const PrefixResolverSetAndRestore theResolverSetAndRestore( 00724 executionContext, 00725 &prefixResolver); 00726 00727 executeMore( 00728 executionContext.getCurrentNode(), 00729 getInitialOpCodePosition(), 00730 executionContext, 00731 result); 00732 } 00733 00734 /** 00735 * Execute the XPath from the provided context. 00736 * 00737 * @param prefixResolver prefix resolver to use 00738 * @param executionContext current execution context 00739 * @param formatterListener the FormatterListener instance to receive the result 00740 * @param function A pointer to the member function of FormatterListener to call 00741 */ 00742 void 00743 execute( 00744 const PrefixResolver& prefixResolver, 00745 XPathExecutionContext& executionContext, 00746 FormatterListener& formatterListener, 00747 MemberFunctionPtr function) const 00748 { 00749 assert(executionContext.getCurrentNode() != 0); 00750 00751 // Push and pop the PrefixResolver... 00752 const PrefixResolverSetAndRestore theResolverSetAndRestore( 00753 executionContext, 00754 &prefixResolver); 00755 00756 executeMore( 00757 executionContext.getCurrentNode(), 00758 getInitialOpCodePosition(), 00759 executionContext, 00760 formatterListener, 00761 function); 00762 } 00763 00764 /** 00765 * Execute the XPath from the provided context. Normally, 00766 * the expression will be evaluated and the result placed 00767 * in the parameter result. However, some cases (such as 00768 * the evalution of a variable) could result in the copying 00769 * of a node-set, which is extremely expensive. In that 00770 * case, the return value will contain the result of the 00771 * evaluation. If the call to XObject::null() on the return 00772 * value is true, that indicates the value was executed 00773 * directly into the parameter. Otherwise, the parameter 00774 * will be empty, and the result will be in the XObject 00775 * instance returned. 00776 * 00777 * The current node must already be set execution context, 00778 * and must not be 0. 00779 * 00780 * @param executionContext current execution context 00781 * @param prefixResolver prefix resolver to use 00782 * @param result A node list for the result. This may or may not contain the actual result. 00783 * @return the node-set result, if the result was not returned in the parameter 00784 */ 00785 XObjectPtr 00786 execute( 00787 const PrefixResolver& prefixResolver, 00788 XPathExecutionContext& executionContext, 00789 MutableNodeRefList& result) const 00790 { 00791 assert(executionContext.getCurrentNode() != 0); 00792 00793 // Push and pop the PrefixResolver... 00794 const PrefixResolverSetAndRestore theResolverSetAndRestore( 00795 executionContext, 00796 &prefixResolver); 00797 00798 return executeMore( 00799 executionContext.getCurrentNode(), 00800 getInitialOpCodePosition(), 00801 executionContext, 00802 result); 00803 } 00804 00805 /** 00806 * Retrieve a reference to the current expression. 00807 * 00808 * @return current expression 00809 */ 00810 XPathExpression& 00811 getExpression() 00812 { 00813 return m_expression; 00814 } 00815 00816 /** 00817 * Retrieve a reference to the current expression. 00818 * 00819 * @return current expression 00820 */ 00821 const XPathExpression& 00822 getExpression() const 00823 { 00824 return m_expression; 00825 } 00826 00827 static double 00828 getMatchScoreValue(eMatchScore score) 00829 { 00830 switch(score) 00831 { 00832 case eMatchScoreNone: 00833 return DoubleSupport::getNegativeInfinity(); 00834 break; 00835 00836 case eMatchScoreNodeTest: 00837 return -0.5; 00838 break; 00839 00840 case eMatchScoreNSWild: 00841 return -0.25; 00842 break; 00843 00844 case eMatchScoreOther: 00845 return 0.5; 00846 break; 00847 00848 case eMatchScoreQName: 00849 return 0.0; 00850 break; 00851 }; 00852 00853 assert(false); 00854 return 0.0; 00855 } 00856 00857 /** 00858 * Get the match score for the specified node. 00859 * 00860 * @param node The node for the score 00861 * @param executionContext current execution context 00862 * @return union of node-set operands 00863 */ 00864 eMatchScore 00865 getMatchScore( 00866 XalanNode* node, 00867 XPathExecutionContext& executionContext) const; 00868 00869 /** 00870 * Get the match score for the specified node. 00871 * 00872 * @param node The node for the score 00873 * @param resolver The prefix resolver 00874 * @param executionContext current execution context 00875 * @return union of node-set operands 00876 */ 00877 eMatchScore 00878 getMatchScore( 00879 XalanNode* node, 00880 const PrefixResolver& resolver, 00881 XPathExecutionContext& executionContext) const; 00882 00883 /** 00884 * Evaluate a predicate. 00885 * 00886 * @param context current source tree context node 00887 * @param opPos current position in the Op Map 00888 * @param executionContext current execution context 00889 * @return pointer to either a boolean or a number 00890 */ 00891 const XObjectPtr 00892 predicate( 00893 XalanNode* context, 00894 OpCodeMapPositionType opPos, 00895 XPathExecutionContext& executionContext) const 00896 { 00897 return executeMore(context, opPos + 2, executionContext); 00898 } 00899 00900 /** 00901 * Add the data for the target of match pattern to a vector. 00902 * 00903 * @param targetData The vector for the data 00904 */ 00905 void 00906 getTargetData(TargetDataVectorType& targetData) const; 00907 00908 /** 00909 * Install a built-in function. 00910 * 00911 * @param funcName unqualified name of the function 00912 * @param func instance of an XPath function object 00913 */ 00914 static void 00915 installFunction( 00916 const XalanDOMString& funcName, 00917 const Function& func) 00918 { 00919 s_functions.InstallFunction(funcName, 00920 func); 00921 } 00922 00923 /** 00924 * Install a built-in function. 00925 * 00926 * @param funcName unqualified name of the function 00927 * @param func instance of an XPath function object 00928 */ 00929 static void 00930 installFunction( 00931 const XalanDOMChar* funcName, 00932 const Function& func) 00933 { 00934 s_functions.InstallFunction(funcName, 00935 func); 00936 } 00937 00938 /** 00939 * Remove a named function from the function table. 00940 * 00941 * @param funcName name of function 00942 * @return true if the function was found and removed. 00943 */ 00944 static bool 00945 uninstallFunction(const XalanDOMString& funcName) 00946 { 00947 return s_functions.UninstallFunction(funcName); 00948 } 00949 00950 /** 00951 * Remove a named function from the function table. 00952 * 00953 * @param funcName name of function 00954 * @return true if the function was found and removed. 00955 */ 00956 static bool 00957 uninstallFunction(const XalanDOMChar* funcName) 00958 { 00959 return s_functions.UninstallFunction(funcName); 00960 } 00961 00962 /** 00963 * Whether the named function is installed in the function table. 00964 * 00965 * @param name of function 00966 * @return true if the function has been installed 00967 */ 00968 static bool 00969 isInstalledFunction(const XalanDOMString& theFunctionName) 00970 { 00971 return s_functions.isInstalledFunction(theFunctionName); 00972 } 00973 00974 typedef XPathFunctionTable FunctionTableType; 00975 00976 /** 00977 * Retrieve the table of installed functions. 00978 * 00979 * @return function table 00980 */ 00981 static const FunctionTableType& 00982 getFunctionTable() 00983 { 00984 return s_functions; 00985 } 00986 00987 /** 00988 * Add the names for the installed functions to a vector strings. 00989 * 00990 * @param theIterator vector added to 00991 */ 00992 template<class OutputIteratorType> 00993 static void 00994 getInstalledFunctionNames(OutputIteratorType theIterator) 00995 { 00996 s_functions.getInstalledFunctionNames(theIterator); 00997 } 00998 00999 static void 01000 destroyTable() 01001 { 01002 s_functions.DestroyTable(); 01003 } 01004 01005 bool 01006 getInStylesheet() const 01007 { 01008 return m_inStylesheet; 01009 } 01010 01011 void 01012 setInStylesheet(bool fValue) 01013 { 01014 m_inStylesheet = fValue; 01015 } 01016 01017 const Locator* 01018 getLocator() const 01019 { 01020 return m_locator; 01021 } 01022 01023 void 01024 setLocator(const Locator* theLocator) 01025 { 01026 m_locator = theLocator; 01027 } 01028 01029 class NodeTester 01030 { 01031 public: 01032 01033 NodeTester(); 01034 01035 NodeTester(const NodeTester& theSource); 01036 01037 NodeTester( 01038 const XPath& xpath, 01039 XPathExecutionContext& executionContext, 01040 OpCodeMapPositionType opPos, 01041 OpCodeMapValueType argLen, 01042 OpCodeMapValueType stepType); 01043 01044 NodeTester( 01045 XPathConstructionContext& theContext, 01046 const XalanDOMString& theNameTest, 01047 const PrefixResolver& thePrefixResolver, 01048 const Locator* theLocator = 0, 01049 eMatchScore* theMatchScore = 0); 01050 01051 NodeTester( 01052 const XalanDOMString& theNamespaceURI, 01053 const XalanDOMString& theLocalName, 01054 eMatchScore* theMatchScore = 0); 01055 01056 eMatchScore 01057 operator()( 01058 const XalanNode& context, 01059 XalanNode::NodeType nodeType) const 01060 { 01061 assert(context.getNodeType() == nodeType); 01062 01063 return (this->*m_testFunction)(context, nodeType); 01064 } 01065 01066 eMatchScore 01067 operator()(const XalanElement& context) const 01068 { 01069 return (this->*m_testFunction2)(context); 01070 } 01071 01072 NodeTester& 01073 operator=(const NodeTester& theRHS) 01074 { 01075 m_executionContext = theRHS.m_executionContext; 01076 m_targetNamespace = theRHS.m_targetNamespace; 01077 m_targetLocalName = theRHS.m_targetLocalName; 01078 m_testFunction = theRHS.m_testFunction; 01079 m_testFunction2 = theRHS.m_testFunction2; 01080 01081 return *this; 01082 } 01083 01084 protected: 01085 01086 eMatchScore 01087 initialize( 01088 XPathConstructionContext& theConstructionContext, 01089 const XalanDOMString& theNameTest, 01090 const PrefixResolver& thePrefixResolver, 01091 const Locator* theLocator); 01092 01093 eMatchScore 01094 initialize( 01095 const XalanDOMString& theNamespaceURI, 01096 const XalanDOMString& theLocalName); 01097 01098 private: 01099 01100 01101 typedef eMatchScore (NodeTester::*TestFunctionPtr)(const XalanNode&, XalanNode::NodeType) const; 01102 typedef eMatchScore (NodeTester::*TestFunctionPtr2)(const XalanElement&) const; 01103 01104 01105 eMatchScore 01106 testComment( 01107 const XalanNode& context, 01108 XalanNode::NodeType nodeType) const; 01109 01110 eMatchScore 01111 testText( 01112 const XalanNode& context, 01113 XalanNode::NodeType nodeType) const; 01114 01115 eMatchScore 01116 testPI( 01117 const XalanNode& context, 01118 XalanNode::NodeType nodeType) const; 01119 01120 eMatchScore 01121 testPIName( 01122 const XalanNode& context, 01123 XalanNode::NodeType nodeType) const; 01124 01125 eMatchScore 01126 testNode( 01127 const XalanNode& context, 01128 XalanNode::NodeType nodeType) const; 01129 01130 eMatchScore 01131 testRoot( 01132 const XalanNode& context, 01133 XalanNode::NodeType nodeType) const; 01134 01135 eMatchScore 01136 testAttributeNCName( 01137 const XalanNode& context, 01138 XalanNode::NodeType nodeType) const; 01139 01140 eMatchScore 01141 testAttributeQName( 01142 const XalanNode& context, 01143 XalanNode::NodeType nodeType) const; 01144 01145 eMatchScore 01146 testAttributeNamespaceOnly( 01147 const XalanNode& context, 01148 XalanNode::NodeType nodeType) const; 01149 01150 eMatchScore 01151 testAttributeTotallyWild( 01152 const XalanNode& context, 01153 XalanNode::NodeType nodeType) const; 01154 01155 eMatchScore 01156 testElementNCName( 01157 const XalanNode& context, 01158 XalanNode::NodeType nodeType) const; 01159 01160 eMatchScore 01161 testElementQName( 01162 const XalanNode& context, 01163 XalanNode::NodeType nodeType) const; 01164 01165 eMatchScore 01166 testElementNamespaceOnly( 01167 const XalanNode& context, 01168 XalanNode::NodeType nodeType) const; 01169 01170 eMatchScore 01171 testElementTotallyWild( 01172 const XalanNode& context, 01173 XalanNode::NodeType nodeType) const; 01174 01175 eMatchScore 01176 testElementNCName2(const XalanElement& context) const; 01177 01178 eMatchScore 01179 testElementQName2(const XalanElement& context) const; 01180 01181 eMatchScore 01182 testElementNamespaceOnly2(const XalanElement& context) const; 01183 01184 eMatchScore 01185 testElementTotallyWild2(const XalanElement& context) const; 01186 01187 eMatchScore 01188 testNamespaceNCName( 01189 const XalanNode& context, 01190 XalanNode::NodeType nodeType) const; 01191 01192 eMatchScore 01193 testNamespaceTotallyWild( 01194 const XalanNode& context, 01195 XalanNode::NodeType nodeType) const; 01196 01197 eMatchScore 01198 testDefault( 01199 const XalanNode& context, 01200 XalanNode::NodeType nodeType) const; 01201 01202 eMatchScore 01203 testDefault2(const XalanElement& context) const; 01204 01205 bool 01206 matchLocalName(const XalanNode& context) const; 01207 01208 bool 01209 matchNamespaceURI(const XalanNode& context) const; 01210 01211 bool 01212 matchLocalNameAndNamespaceURI(const XalanNode& context) const; 01213 01214 bool 01215 matchNamespace(const XalanNode& context) const; 01216 01217 bool 01218 shouldStripSourceNode(const XalanText& context) const; 01219 01220 // Data members... 01221 XPathExecutionContext* m_executionContext; 01222 01223 const XalanDOMString* m_targetNamespace; 01224 01225 const XalanDOMString* m_targetLocalName; 01226 01227 TestFunctionPtr m_testFunction; 01228 01229 TestFunctionPtr2 m_testFunction2; 01230 }; 01231 01232 friend class NodeTester; 01233 01234 protected: 01235 01236 /** 01237 * Execute a location path. 01238 * 01239 * @param context current source tree context node 01240 * @param opPos current position in the Op Mpa 01241 * @param executionContext current execution context 01242 * @return node-set 01243 */ 01244 const XObjectPtr 01245 locationPath( 01246 XalanNode* context, 01247 OpCodeMapPositionType opPos, 01248 XPathExecutionContext& executionContext) const; 01249 01250 /** 01251 * Execute a location path. 01252 * 01253 * @param context current source tree context node 01254 * @param opPos current position in the Op Map 01255 * @param executionContext current execution context 01256 * @param theResult the result as a node list 01257 */ 01258 void 01259 locationPath( 01260 XalanNode* context, 01261 OpCodeMapPositionType opPos, 01262 XPathExecutionContext& executionContext, 01263 bool& theResult) const; 01264 01265 /** 01266 * Execute a location path. 01267 * 01268 * @param context current source tree context node 01269 * @param opPos current position in the Op Map 01270 * @param executionContext current execution context 01271 * @param theResult the result as a node list 01272 */ 01273 void 01274 locationPath( 01275 XalanNode* context, 01276 OpCodeMapPositionType opPos, 01277 XPathExecutionContext& executionContext, 01278 double& theResult) const; 01279 01280 /** 01281 * Execute a location path. 01282 * 01283 * @param context current source tree context node 01284 * @param opPos current position in the Op Map 01285 * @param executionContext current execution context 01286 * @param theResult the result as a node list 01287 */ 01288 void 01289 locationPath( 01290 XalanNode* context, 01291 OpCodeMapPositionType opPos, 01292 XPathExecutionContext& executionContext, 01293 XalanDOMString& theResult) const; 01294 01295 /** 01296 * Execute a location path. 01297 * 01298 * @param context current source tree context node 01299 * @param opPos current position in the Op Map 01300 * @param executionContext current execution context 01301 * @param formatterListener the FormatterListener instance to receive the result 01302 * @param function A pointer to the member function of FormatterListener to call 01303 */ 01304 void 01305 locationPath( 01306 XalanNode* context, 01307 OpCodeMapPositionType opPos, 01308 XPathExecutionContext& executionContext, 01309 FormatterListener& formatterListener, 01310 MemberFunctionPtr function) const; 01311 01312 /** 01313 * Execute a location path. 01314 * 01315 * @param context current source tree context node 01316 * @param opPos current position in the Op Map 01317 * @param executionContext current execution context 01318 * @param theResult the result as a node list 01319 */ 01320 void 01321 locationPath( 01322 XalanNode* context, 01323 OpCodeMapPositionType opPos, 01324 XPathExecutionContext& executionContext, 01325 MutableNodeRefList& theResult) const 01326 { 01327 step(executionContext, context, opPos + 2, theResult); 01328 } 01329 01330 /** 01331 * Execute the XPath from the provided context. 01332 * 01333 * @param context current source tree context node 01334 * @param opPos current position in the Op Map 01335 * @param executionContext current execution context 01336 * @return pointer to union of node-set operands 01337 */ 01338 const XObjectPtr 01339 executeMore( 01340 XalanNode* context, 01341 OpCodeMapPositionType opPos, 01342 XPathExecutionContext& executionContext) const; 01343 01344 /** 01345 * Execute the XPath from the provided context. 01346 * 01347 * @param context current source tree context node 01348 * @param opPos current position in the Op Map 01349 * @param executionContext current execution context 01350 * @param theResult The result of the execution 01351 */ 01352 void 01353 executeMore( 01354 XalanNode* context, 01355 OpCodeMapPositionType opPos, 01356 XPathExecutionContext& executionContext, 01357 bool& theResult) const; 01358 01359 /** 01360 * Execute the XPath from the provided context. 01361 * 01362 * @param context current source tree context node 01363 * @param opPos current position in the Op Map 01364 * @param executionContext current execution context 01365 * @param theResult The result of the execution 01366 */ 01367 void 01368 executeMore( 01369 XalanNode* context, 01370 OpCodeMapPositionType opPos, 01371 XPathExecutionContext& executionContext, 01372 double& theResult) const; 01373 01374 /** 01375 * Execute the XPath from the provided context. The result 01376 * is appended to the supplied string. 01377 * 01378 * @param context current source tree context node 01379 * @param opPos current position in the Op Map 01380 * @param executionContext current execution context 01381 * @param theResult The result of the execution 01382 */ 01383 void 01384 executeMore( 01385 XalanNode* context, 01386 OpCodeMapPositionType opPos, 01387 XPathExecutionContext& executionContext, 01388 XalanDOMString& theResult) const; 01389 01390 /** 01391 * Execute the XPath from the provided context. 01392 * 01393 * @param context current source tree context node 01394 * @param opPos current position in the Op Map 01395 * @param executionContext current execution context 01396 * @param formatterListener the FormatterListener instance to receive the result 01397 * @param function A pointer to the member function of FormatterListener to call 01398 */ 01399 void 01400 executeMore( 01401 XalanNode* context, 01402 OpCodeMapPositionType opPos, 01403 XPathExecutionContext& executionContext, 01404 FormatterListener& formatterListener, 01405 MemberFunctionPtr function) const; 01406 01407 /** 01408 * Execute the XPath from the provided context. 01409 * 01410 * @param context current source tree context node 01411 * @param opPos current position in the Op Map 01412 * @param executionContext current execution context 01413 * @param theResult The result of the execution 01414 * @return the node-set result, if the result was not returned in the parameter 01415 */ 01416 const XObjectPtr 01417 executeMore( 01418 XalanNode* context, 01419 OpCodeMapPositionType opPos, 01420 XPathExecutionContext& executionContext, 01421 MutableNodeRefList& theResult) const; 01422 01423 /** 01424 * Helper function to get match score. 01425 * @param context The current source tree context node. 01426 * @param executionContext The current execution context 01427 * @param score The match score 01428 */ 01429 void 01430 doGetMatchScore( 01431 XalanNode* context, 01432 XPathExecutionContext& executionContext, 01433 eMatchScore& score) const; 01434 01435 /** 01436 * OR two expressions and return the boolean result. 01437 * @param context The current source tree context node. 01438 * @param opPos The current position in the Op Map. 01439 * @param executionContext current execution context 01440 * @return true if the one of the two arguments are true. 01441 */ 01442 bool 01443 Or( 01444 XalanNode* context, 01445 OpCodeMapPositionType opPos, 01446 XPathExecutionContext& executionContext) const; 01447 01448 /** 01449 * OR two expressions and return the boolean result. 01450 * @param context The current source tree context node. 01451 * @param opPos The current position in the Op Map. 01452 * @param executionContext current execution context 01453 * @return true if the two arguments are both true. 01454 */ 01455 bool 01456 And( 01457 XalanNode* context, 01458 OpCodeMapPositionType opPos, 01459 XPathExecutionContext& executionContext) const; 01460 01461 /** 01462 * Tell if two expressions are functionally not equal. 01463 * @param context The current source tree context node. 01464 * @param opPos The current position in the Op Map. 01465 * @param executionContext current execution context 01466 * @return true if the two arguments are not equal. 01467 */ 01468 bool 01469 notequals( 01470 XalanNode* context, 01471 OpCodeMapPositionType opPos, 01472 XPathExecutionContext& executionContext) const; 01473 01474 /** 01475 * Tell if two expressions are functionally equal. 01476 * @param context The current source tree context node. 01477 * @param opPos The current position in the Op Map. 01478 * @param executionContext current execution context 01479 * @return true if the two arguments are equal. 01480 */ 01481 bool 01482 equals( 01483 XalanNode* context, 01484 OpCodeMapPositionType opPos, 01485 XPathExecutionContext& executionContext) const; 01486 01487 /** 01488 * Tell if one argument is less than or equal to the other argument. 01489 * @param context The current source tree context node. 01490 * @param opPos The current position in the Op Map. 01491 * @param executionContext current execution context 01492 * @return true if arg 1 is less than or equal to arg 2. 01493 */ 01494 bool 01495 lte( 01496 XalanNode* context, 01497 OpCodeMapPositionType opPos, 01498 XPathExecutionContext& executionContext) const; 01499 01500 /** 01501 * Tell if one argument is less than the other argument. 01502 * @param context The current source tree context node. 01503 * @param opPos The current position in the Op Map. 01504 * @param executionContext current execution context 01505 * @return true if arg 1 is less than arg 2. 01506 */ 01507 bool 01508 lt( 01509 XalanNode* context, 01510 OpCodeMapPositionType opPos, 01511 XPathExecutionContext& executionContext) const; 01512 01513 /** 01514 * Tell if one argument is greater than or equal to the other argument. 01515 * @param context The current source tree context node. 01516 * @param opPos The current position in the Op Map. 01517 * @param executionContext current execution context 01518 * @return true if arg 1 is greater than or equal to arg 2. 01519 */ 01520 bool 01521 gte( 01522 XalanNode* context, 01523 OpCodeMapPositionType opPos, 01524 XPathExecutionContext& executionContext) const; 01525 01526 /** 01527 * Tell if one argument is greater than the other argument. 01528 * @param context The current source tree context node. 01529 * @param opPos The current position in the Op Map. 01530 * @param executionContext current execution context 01531 * @return true if arg 1 is greater than arg 2. 01532 */ 01533 bool 01534 gt( 01535 XalanNode* context, 01536 OpCodeMapPositionType opPos, 01537 XPathExecutionContext& executionContext) const; 01538 01539 /** 01540 * Give the sum of two arguments. 01541 * @param context The current source tree context node. 01542 * @param opPos The current position in the Op Map. 01543 * @param executionContext current execution context 01544 * @return sum of arg1 and arg2. 01545 */ 01546 double 01547 plus( 01548 XalanNode* context, 01549 OpCodeMapPositionType opPos, 01550 XPathExecutionContext& executionContext) const; 01551 01552 /** 01553 * Give the sum of two arguments. 01554 * @param context The current source tree context node. 01555 * @param opPos The current position in the Op Map. 01556 * @param executionContext current execution context 01557 * @param formatterListener the FormatterListener instance to receive the result 01558 * @param function A pointer to the member function of FormatterListener to call 01559 */ 01560 void 01561 plus( 01562 XalanNode* context, 01563 OpCodeMapPositionType opPos, 01564 XPathExecutionContext& executionContext, 01565 FormatterListener& formatterListener, 01566 MemberFunctionPtr function) const; 01567 01568 /** 01569 * Give the difference of two arguments. 01570 * @param context The current source tree context node. 01571 * @param opPos The current position in the Op Map. 01572 * @param executionContext current execution context 01573 * @return difference of arg1 and arg2. 01574 */ 01575 double 01576 minus( 01577 XalanNode* context, 01578 OpCodeMapPositionType opPos, 01579 XPathExecutionContext& executionContext) const; 01580 01581 /** 01582 * Give the difference of two arguments. 01583 * @param context The current source tree context node. 01584 * @param opPos The current position in the Op Map. 01585 * @param executionContext current execution context 01586 * @param formatterListener the FormatterListener instance to receive the result 01587 * @param function A pointer to the member function of FormatterListener to call 01588 */ 01589 void 01590 minus( 01591 XalanNode* context, 01592 OpCodeMapPositionType opPos, 01593 XPathExecutionContext& executionContext, 01594 FormatterListener& formatterListener, 01595 MemberFunctionPtr function) const; 01596 01597 /** 01598 * Multiply two arguments. 01599 * @param context The current source tree context node. 01600 * @param opPos The current position in the Op Map. 01601 * @param executionContext current execution context 01602 * @return arg1 * arg2. 01603 */ 01604 double 01605 mult( 01606 XalanNode* context, 01607 OpCodeMapPositionType opPos, 01608 XPathExecutionContext& executionContext) const; 01609 01610 /** 01611 * Multiply two arguments. 01612 * @param context The current source tree context node. 01613 * @param opPos The current position in the Op Map. 01614 * @param executionContext current execution context 01615 * @param formatterListener the FormatterListener instance to receive the result 01616 * @param function A pointer to the member function of FormatterListener to call 01617 */ 01618 void 01619 mult( 01620 XalanNode* context, 01621 OpCodeMapPositionType opPos, 01622 XPathExecutionContext& executionContext, 01623 FormatterListener& formatterListener, 01624 MemberFunctionPtr function) const; 01625 01626 /** 01627 * Divide a number. 01628 * @param context The current source tree context node. 01629 * @param opPos The current position in the Op Map. 01630 * @param executionContext current execution context 01631 * @return arg1 / arg2. 01632 */ 01633 double 01634 div( 01635 XalanNode* context, 01636 OpCodeMapPositionType opPos, 01637 XPathExecutionContext& executionContext) const; 01638 01639 /** 01640 * Divide a number. 01641 * @param context The current source tree context node. 01642 * @param opPos The current position in the Op Map. 01643 * @param executionContext current execution context 01644 * @param formatterListener the FormatterListener instance to receive the result 01645 * @param function A pointer to the member function of FormatterListener to call 01646 */ 01647 void 01648 div( 01649 XalanNode* context, 01650 OpCodeMapPositionType opPos, 01651 XPathExecutionContext& executionContext, 01652 FormatterListener& formatterListener, 01653 MemberFunctionPtr function) const; 01654 01655 /** 01656 * Return the remainder from a truncating division. 01657 * @param context The current source tree context node. 01658 * @param opPos The current position in the Op Map. 01659 * @param executionContext current execution context 01660 * @return arg1 mod arg2. 01661 */ 01662 double 01663 mod( 01664 XalanNode* context, 01665 OpCodeMapPositionType opPos, 01666 XPathExecutionContext& executionContext) const; 01667 01668 /** 01669 * Return the remainder from a truncating division. 01670 * @param context The current source tree context node. 01671 * @param opPos The current position in the Op Map. 01672 * @param executionContext current execution context 01673 * @param formatterListener the FormatterListener instance to receive the result 01674 * @param function A pointer to the member function of FormatterListener to call 01675 */ 01676 void 01677 mod( 01678 XalanNode* context, 01679 OpCodeMapPositionType opPos, 01680 XPathExecutionContext& executionContext, 01681 FormatterListener& formatterListener, 01682 MemberFunctionPtr function) const; 01683 01684 /** 01685 * Return the negation of a number. 01686 * @param context The current source tree context node. 01687 * @param opPos The current position in the Op Map. 01688 * @param executionContext current execution context 01689 * @return -arg. 01690 */ 01691 double 01692 neg( 01693 XalanNode* context, 01694 OpCodeMapPositionType opPos, 01695 XPathExecutionContext& executionContext) const; 01696 01697 /** 01698 * Return the negation of a number. 01699 * @param context The current source tree context node. 01700 * @param opPos The current position in the Op Map. 01701 * @param executionContext current execution context 01702 * @param formatterListener the FormatterListener instance to receive the result 01703 * @param function A pointer to the member function of FormatterListener to call 01704 */ 01705 void 01706 neg( 01707 XalanNode* context, 01708 OpCodeMapPositionType opPos, 01709 XPathExecutionContext& executionContext, 01710 FormatterListener& formatterListener, 01711 MemberFunctionPtr function) const; 01712 01713 /** 01714 * Computes the union of its operands which must be node-sets. 01715 * @param context The current source tree context node. 01716 * @param opPos The current position in the Op Map. 01717 * @param executionContext current execution context 01718 * @return the union of node-set operands. 01719 */ 01720 const XObjectPtr 01721 Union( 01722 XalanNode* context, 01723 OpCodeMapPositionType opPos, 01724 XPathExecutionContext& executionContext) const; 01725 01726 /** 01727 * Computes the union of its operands which must be node-sets. 01728 * 01729 * @param context The current source tree context node. 01730 * @param opPos The current position in the Op Map. 01731 * @param executionContext current execution context 01732 * @result the result of the union of node-set operands. 01733 */ 01734 void 01735 Union( 01736 XalanNode* context, 01737 OpCodeMapPositionType opPos, 01738 XPathExecutionContext& executionContext, 01739 bool& result) const; 01740 01741 /** 01742 * Computes the union of its operands which must be node-sets. 01743 * 01744 * @param context The current source tree context node. 01745 * @param opPos The current position in the Op Map. 01746 * @param executionContext current execution context 01747 * @result the result of the union of node-set operands. 01748 */ 01749 void 01750 Union( 01751 XalanNode* context, 01752 OpCodeMapPositionType opPos, 01753 XPathExecutionContext& executionContext, 01754 double& result) const; 01755 01756 /** 01757 * Computes the union of its operands which must be node-sets. 01758 * 01759 * @param context The current source tree context node. 01760 * @param opPos The current position in the Op Map. 01761 * @param executionContext current execution context 01762 * @result the result of the union of node-set operands. 01763 */ 01764 void 01765 Union( 01766 XalanNode* context, 01767 OpCodeMapPositionType opPos, 01768 XPathExecutionContext& executionContext, 01769 XalanDOMString& result) const; 01770 01771 /** 01772 * Computes the union of its operands which must be node-sets. 01773 * 01774 * @param context The current source tree context node. 01775 * @param opPos The current position in the Op Map. 01776 * @param executionContext current execution context 01777 * @param formatterListener the FormatterListener instance to receive the result 01778 * @param function A pointer to the member function of FormatterListener to call 01779 */ 01780 void 01781 Union( 01782 XalanNode* context, 01783 OpCodeMapPositionType opPos, 01784 XPathExecutionContext& executionContext, 01785 FormatterListener& formatterListener, 01786 MemberFunctionPtr function) const; 01787 01788 /** 01789 * Computes the union of its operands which must be node-sets. 01790 * @param context The current source tree context node. 01791 * @param opPos The current position in the Op Map. 01792 * @param executionContext current execution context 01793 * @result the result of the union of node-set operands. 01794 */ 01795 void 01796 Union( 01797 XalanNode* context, 01798 OpCodeMapPositionType opPos, 01799 XPathExecutionContext& executionContext, 01800 MutableNodeRefList& result) const; 01801 01802 /** 01803 * Get a literal value. 01804 * @param opPos The current position in the Op Map. 01805 * @param executionContext current execution context 01806 * @return an XObject object. 01807 */ 01808 const XObjectPtr 01809 literal( 01810 OpCodeMapPositionType opPos, 01811 XPathExecutionContext& executionContext) const; 01812 01813 /** 01814 * Get a literal value as a boolean. 01815 * 01816 * @param opPos The current position in the Op Map. 01817 * @param theResult The value. 01818 */ 01819 void 01820 literal( 01821 OpCodeMapPositionType opPos, 01822 bool& theResult) const; 01823 01824 /** 01825 * Get a literal value as a number. 01826 * 01827 * @param opPos The current position in the Op Map. 01828 * @param theResult The value. 01829 */ 01830 void 01831 literal( 01832 OpCodeMapPositionType opPos, 01833 double& theResult) const; 01834 01835 /** 01836 * Get a literal value. The value is appended to the 01837 * supplied string. 01838 * 01839 * @param opPos The current position in the Op Map. 01840 * @param theResult The string. 01841 */ 01842 void 01843 literal( 01844 OpCodeMapPositionType opPos, 01845 XalanDOMString& theResult) const; 01846 01847 /** 01848 * Get a literal value. 01849 * @param opPos The current position in the Op Map. 01850 * @param executionContext current execution context 01851 * @return The result as a double. 01852 */ 01853 void 01854 literal( 01855 OpCodeMapPositionType opPos, 01856 FormatterListener& formatterListener, 01857 MemberFunctionPtr function) const; 01858 01859 /** 01860 * Get the value of a variable. 01861 * @param opPos The current position in the Op Map. 01862 * @param executionContext current execution context 01863 * @return an XObject object. 01864 */ 01865 const XObjectPtr 01866 variable( 01867 OpCodeMapPositionType opPos, 01868 XPathExecutionContext& executionContext) const; 01869 01870 /** 01871 * Execute an expression as a group. 01872 * @param context The current source tree context node. 01873 * @param opPos The current position in the Op Map. 01874 * @param executionContext current execution context 01875 * @return arg. 01876 */ 01877 const XObjectPtr 01878 group( 01879 XalanNode* context, 01880 OpCodeMapPositionType opPos, 01881 XPathExecutionContext& executionContext) const 01882 { 01883 return executeMore(context, opPos + 2, executionContext); 01884 } 01885 01886 /** 01887 * Execute an expression as a group. 01888 * @param context The current source tree context node. 01889 * @param opPos The current position in the Op Map. 01890 * @param executionContext current execution context 01891 * @param theResult The result of the execution 01892 */ 01893 void 01894 group( 01895 XalanNode* context, 01896 OpCodeMapPositionType opPos, 01897 XPathExecutionContext& executionContext, 01898 bool& theResult) const 01899 { 01900 executeMore(context, opPos + 2, executionContext, theResult); 01901 } 01902 01903 /** 01904 * Execute an expression as a group. 01905 * @param context The current source tree context node. 01906 * @param opPos The current position in the Op Map. 01907 * @param executionContext current execution context 01908 * @param theResult The result of the execution 01909 */ 01910 void 01911 group( 01912 XalanNode* context, 01913 OpCodeMapPositionType opPos, 01914 XPathExecutionContext& executionContext, 01915 double& theResult) const 01916 { 01917 executeMore(context, opPos + 2, executionContext, theResult); 01918 } 01919 01920 /** 01921 * Execute an expression as a group. 01922 * @param context The current source tree context node. 01923 * @param opPos The current position in the Op Map. 01924 * @param executionContext current execution context 01925 * @param theResult The result of the execution 01926 */ 01927 void 01928 group( 01929 XalanNode* context, 01930 OpCodeMapPositionType opPos, 01931 XPathExecutionContext& executionContext, 01932 XalanDOMString& theResult) const 01933 { 01934 executeMore(context, opPos + 2, executionContext, theResult); 01935 } 01936 01937 /** 01938 * Execute an expression as a group. 01939 * 01940 * @param context The current source tree context node. 01941 * @param opPos The current position in the Op Map. 01942 * @param executionContext current execution context 01943 * @param formatterListener the FormatterListener instance to receive the result 01944 * @param function A pointer to the member function of FormatterListener to call 01945 */ 01946 void 01947 group( 01948 XalanNode* context, 01949 OpCodeMapPositionType opPos, 01950 XPathExecutionContext& executionContext, 01951 FormatterListener& formatterListener, 01952 MemberFunctionPtr function) const 01953 { 01954 executeMore( 01955 context, 01956 opPos + 2, 01957 executionContext, 01958 formatterListener, 01959 function); 01960 } 01961 01962 /** 01963 * Execute an expression as a group. 01964 * @param context The current source tree context node. 01965 * @param opPos The current position in the Op Map. 01966 * @param executionContext current execution context 01967 * @param theResult The result of the execution 01968 */ 01969 void 01970 group( 01971 XalanNode* context, 01972 OpCodeMapPositionType opPos, 01973 XPathExecutionContext& executionContext, 01974 MutableNodeRefList& theResult) const 01975 { 01976 const XObjectPtr theValue(executeMore( 01977 context, 01978 opPos + 2, 01979 executionContext, 01980 theResult)); 01981 01982 if (theValue.null() == false) 01983 { 01984 theResult.addNodesInDocOrder( 01985 theValue->nodeset(), 01986 executionContext); 01987 01988 theResult.setDocumentOrder(); 01989 } 01990 } 01991 01992 /** 01993 * Get a literal value. 01994 * @param opPos The current position in the Op Map. 01995 * @return The result as a double. 01996 */ 01997 double 01998 numberlit(OpCodeMapPositionType opPos) const; 01999 02000 /** 02001 * Get a literal value. 02002 * @param opPos The current position in the Op Map. 02003 * @return The result as a double. 02004 */ 02005 const XObjectPtr 02006 numberlit( 02007 OpCodeMapPositionType opPos, 02008 XPathExecutionContext& executionContext) const; 02009 02010 /** 02011 * Get a literal value as a boolean. 02012 * 02013 * @param opPos The current position in the Op Map. 02014 * @param theResult The string. 02015 */ 02016 void 02017 numberlit( 02018 OpCodeMapPositionType opPos, 02019 bool& theResult) const; 02020 02021 /** 02022 * Get a literal value. The value is appended to the 02023 * supplied string. 02024 * 02025 * @param opPos The current position in the Op Map. 02026 * @param theResult The string. 02027 */ 02028 void 02029 numberlit( 02030 OpCodeMapPositionType opPos, 02031 XalanDOMString& theResult) const; 02032 02033 /** 02034 * Get a literal value. 02035 * 02036 * @param opPos The current position in the Op Map. 02037 * @param formatterListener the FormatterListener instance to receive the result 02038 * @param function A pointer to the member function of FormatterListener to call 02039 */ 02040 void 02041 numberlit( 02042 OpCodeMapPositionType opPos, 02043 FormatterListener& formatterListener, 02044 MemberFunctionPtr function) const; 02045 02046 /** 02047 * Setup for and run an extension function. 02048 * @param context The current source tree context node. 02049 * @param opPos The current position in the Op Map. 02050 * @param executionContext current execution context 02051 * @return the result of the function. 02052 */ 02053 const XObjectPtr 02054 runExtFunction( 02055 XalanNode* context, 02056 OpCodeMapPositionType opPos, 02057 XPathExecutionContext& executionContext) const; 02058 02059 /** 02060 * Handle an extension function. 02061 * @param context The current source tree context node. 02062 * @param opPos The current position in the Op Map. 02063 * @param theNamespace The namespace of the function. 02064 * @param functionName The name of the function. 02065 * @param executionContext current execution context 02066 * @return the result of the function. 02067 */ 02068 const XObjectPtr 02069 extfunction( 02070 XalanNode* context, 02071 OpCodeMapPositionType /* opPos */, 02072 const XalanDOMString& theNamespace, 02073 const XalanDOMString& functionName, 02074 const Function::XObjectArgVectorType& argVec, 02075 XPathExecutionContext& executionContext) const 02076 { 02077 return executionContext.extFunction(theNamespace, 02078 functionName, 02079 context, 02080 argVec, 02081 m_locator); 02082 } 02083 02084 /** 02085 * Setup for and run a function. 02086 * @param context The current source tree context node. 02087 * @param opPos The current position in the Op Map. 02088 * @param executionContext current execution context 02089 * @return the result of the function. 02090 */ 02091 const XObjectPtr 02092 runFunction( 02093 XalanNode* context, 02094 OpCodeMapPositionType opPos, 02095 XPathExecutionContext& executionContext) const; 02096 02097 /** 02098 * Handle a built-in function. 02099 * @param context The current source tree context node. 02100 * @param funcID The function ID. 02101 * @param argVec The arguments for the function. 02102 * @param executionContext current execution context 02103 * @return the result of the function. 02104 */ 02105 const XObjectPtr 02106 function( 02107 XalanNode* context, 02108 OpCodeMapValueType funcID, 02109 const Function::XObjectArgVectorType& argVec, 02110 XPathExecutionContext& executionContext) const 02111 { 02112 return s_functions[funcID].execute(executionContext, context, argVec, m_locator); 02113 } 02114 02115 /** 02116 * Handle the built-in function "position". 02117 * 02118 * @param context The current source tree context node, which must not be 0. 02119 * @param executionContext current execution context 02120 * @return the result of the function. 02121 */ 02122 double 02123 functionPosition( 02124 XalanNode* context, 02125 XPathExecutionContext& executionContext) const 02126 { 02127 assert(context != 0); 02128 02129 const XPathExecutionContext::size_type theResult = 02130 executionContext.getContextNodeListPosition(*context); 02131 assert(static_cast<double>(theResult) == theResult); 02132 02133 return static_cast<double>(theResult); 02134 } 02135 02136 /** 02137 * Handle the built-in function "last". 02138 * 02139 * @param executionContext current execution context 02140 * @return the result of the function. 02141 */ 02142 double 02143 functionLast(XPathExecutionContext& executionContext) const 02144 { 02145 const XPathExecutionContext::size_type theResult = 02146 executionContext.getContextNodeListLength(); 02147 assert(static_cast<double>(theResult) == theResult); 02148 02149 return static_cast<double>(theResult); 02150 } 02151 02152 /** 02153 * Handle the built-in function "count". 02154 * 02155 * @param context The current source tree context node. 02156 * @param opPos The current position in the Op Map. 02157 * @param executionContext current execution context 02158 * @return the result of the function. 02159 */ 02160 double 02161 functionCount( 02162 XalanNode* context, 02163 OpCodeMapPositionType opPos, 02164 XPathExecutionContext& executionContext) const; 02165 02166 /** 02167 * Handle the built-in function "not". 02168 * 02169 * @param context The current source tree context node, which must not be 0. 02170 * @param opPos The current position in the Op Map. 02171 * @param executionContext current execution context 02172 * @return the result of the function. 02173 */ 02174 bool 02175 functionNot( 02176 XalanNode* context, 02177 OpCodeMapPositionType opPos, 02178 XPathExecutionContext& executionContext) const 02179 { 02180 assert(context != 0); 02181 02182 return !functionBoolean(context, opPos, executionContext); 02183 } 02184 02185 /** 02186 * Handle the built-in function "boolean". 02187 * 02188 * @param context The current source tree context node, which must not be 0. 02189 * @param opPos The current position in the Op Map. 02190 * @param executionContext current execution context 02191 * @return the result of the function. 02192 */ 02193 bool 02194 functionBoolean( 02195 XalanNode* context, 02196 OpCodeMapPositionType opPos, 02197 XPathExecutionContext& executionContext) const 02198 { 02199 assert(context != 0); 02200 02201 bool result; 02202 02203 executeMore(context, opPos + 2, executionContext, result); 02204 02205 return result; 02206 } 02207 02208 /** 02209 * Handle the built-in function "name". 02210 * 02211 * @param context The current source tree context node, which must not be 0. 02212 * @return the result of the function. 02213 */ 02214 const XalanDOMString& 02215 functionName(XalanNode* context) const 02216 { 02217 assert(context != 0); 02218 02219 return DOMServices::getNameOfNode(*context); 02220 } 02221 02222 /** 02223 * Handle the built-in function "name". 02224 * 02225 * @param context The current source tree context node, which must not be 0. 02226 * @param opPos The current position in the Op Map. 02227 * @param executionContext current execution context 02228 * @return the result of the function. 02229 */ 02230 const XalanDOMString& 02231 functionName( 02232 XalanNode* context, 02233 OpCodeMapPositionType opPos, 02234 XPathExecutionContext& executionContext) const; 02235 02236 /** 02237 * Handle the built-in function "local-name". 02238 * 02239 * @param context The current source tree context node, which must not be 0. 02240 * @return the result of the function. 02241 */ 02242 const XalanDOMString& 02243 functionLocalName(XalanNode* context) const; 02244 02245 /** 02246 * Handle the built-in function "local-name". 02247 * 02248 * @param context The current source tree context node, which must not be 0. 02249 * @param opPos The current position in the Op Map. 02250 * @param executionContext current execution context 02251 * @return the result of the function. 02252 */ 02253 const XalanDOMString& 02254 functionLocalName( 02255 XalanNode* context, 02256 OpCodeMapPositionType opPos, 02257 XPathExecutionContext& executionContext) const; 02258 02259 /** 02260 * Handle the built-in function "number". 02261 * 02262 * @param context The current source tree context node, which must not be 0. 02263 * @param executionContext current execution context 02264 * @return the result of the function. 02265 */ 02266 double 02267 functionNumber( 02268 XalanNode* context, 02269 XPathExecutionContext& executionContext) const 02270 { 02271 assert(context != 0); 02272 02273 return XObject::number(executionContext, *context); 02274 } 02275 02276 /** 02277 * Handle the built-in function "number". 02278 * 02279 * @param context The current source tree context node, which must not be 0. 02280 * @param opPos The current position in the Op Map. 02281 * @param executionContext current execution context 02282 * @return the result of the function. 02283 */ 02284 double 02285 functionNumber( 02286 XalanNode* context, 02287 OpCodeMapPositionType opPos, 02288 XPathExecutionContext& executionContext) const 02289 { 02290 double result; 02291 02292 executeMore(context, opPos + 2, executionContext, result); 02293 02294 return result; 02295 } 02296 02297 /** 02298 * Handle the built-in function "floor". 02299 * 02300 * @param context The current source tree context node, which must not be 0. 02301 * @param opPos The current position in the Op Map. 02302 * @param executionContext current execution context 02303 * @return the result of the function. 02304 */ 02305 double 02306 functionFloor( 02307 XalanNode* context, 02308 OpCodeMapPositionType opPos, 02309 XPathExecutionContext& executionContext) const 02310 { 02311 return DoubleSupport::floor(functionNumber(context, opPos, executionContext)); 02312 } 02313 02314 /** 02315 * Handle the built-in function "ceiling". 02316 * 02317 * @param context The current source tree context node, which must not be 0. 02318 * @param opPos The current position in the Op Map. 02319 * @param executionContext current execution context 02320 * @return the result of the function. 02321 */ 02322 double 02323 functionCeiling( 02324 XalanNode* context, 02325 OpCodeMapPositionType opPos, 02326 XPathExecutionContext& executionContext) const 02327 { 02328 return DoubleSupport::ceiling(functionNumber(context, opPos, executionContext)); 02329 } 02330 02331 /** 02332 * Handle the built-in function "round". 02333 * 02334 * @param context The current source tree context node, which must not be 0. 02335 * @param opPos The current position in the Op Map. 02336 * @param executionContext current execution context 02337 * @return the result of the function. 02338 */ 02339 double 02340 functionRound( 02341 XalanNode* context, 02342 OpCodeMapPositionType opPos, 02343 XPathExecutionContext& executionContext) const 02344 { 02345 return DoubleSupport::round(functionNumber(context, opPos, executionContext)); 02346 } 02347 02348 /** 02349 * Handle the built-in function "string-length". 02350 * 02351 * @param context The current source tree context node, which must not be 0. 02352 * @param executionContext current execution context 02353 * @return the result of the function. 02354 */ 02355 double 02356 functionStringLength( 02357 XalanNode* context, 02358 XPathExecutionContext& executionContext) const; 02359 02360 /** 02361 * Handle the built-in function "string-length". 02362 * 02363 * @param context The current source tree context node, which must not be 0. 02364 * @param opPos The current position in the Op Map. 02365 * @param executionContext current execution context 02366 * @return the result of the function. 02367 */ 02368 double 02369 functionStringLength( 02370 XalanNode* context, 02371 OpCodeMapPositionType opPos, 02372 XPathExecutionContext& executionContext) const; 02373 02374 /** 02375 * Handle the built-in function "sum". 02376 * 02377 * @param context The current source tree context node. 02378 * @param opPos The current position in the Op Map. 02379 * @param executionContext current execution context 02380 * @return the result of the function. 02381 */ 02382 double 02383 functionSum( 02384 XalanNode* context, 02385 OpCodeMapPositionType opPos, 02386 XPathExecutionContext& executionContext) const; 02387 02388 /** 02389 * Get a numeric operand for an expression. 02390 * @param context The current source tree context node. 02391 * @param opPos The current position in the Op Map. 02392 * @param executionContext current execution context 02393 * @return The value of the operand. 02394 */ 02395 double 02396 getNumericOperand( 02397 XalanNode* context, 02398 OpCodeMapPositionType opPos, 02399 XPathExecutionContext& executionContext) const; 02400 02401 private: 02402 02403 // These are not implemented... 02404 XPath(const XPath&); 02405 02406 XPath& 02407 operator=(const XPath&); 02408 02409 bool 02410 operator==(const XPath&) const; 02411 02412 // Default vector allocation sizes. 02413 enum 02414 { 02415 eDefaultTargetDataSize = 5 02416 }; 02417 02418 OpCodeMapPositionType 02419 getInitialOpCodePosition() const 02420 { 02421 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS) 02422 assert(m_expression.getOpCodeMapValue(0) == XPathExpression::eOP_XPATH); 02423 #else 02424 assert(m_expression.getOpCodeMapValue( 02425 m_expression.getInitialOpCodePosition()) == XPathExpression::eOP_XPATH); 02426 #endif 02427 return m_expression.getInitialOpCodePosition() + 2; 02428 } 02429 02430 eMatchScore 02431 locationPathPattern( 02432 XPathExecutionContext& executionContext, 02433 XalanNode& context, 02434 OpCodeMapPositionType opPos) const; 02435 02436 protected: 02437 02438 /** 02439 * Execute a step in a location path. 02440 * 02441 * @param xpath The xpath that is executing 02442 * @param context The current source tree context node 02443 * @param opPos The current position in the xpath operation map array 02444 * @param queryResults The set of nodes that matches the step. 02445 */ 02446 void 02447 step( 02448 XPathExecutionContext& executionContext, 02449 XalanNode* context, 02450 OpCodeMapPositionType opPos, 02451 MutableNodeRefList& queryResults) const; 02452 02453 /** 02454 * Potentially evaluate a predicate in a match pattern step. 02455 * 02456 * @param executionContext The current execution context. 02457 * @param context The current source tree context node. 02458 * @param opPos The current position in the Op Map. 02459 * @param startOpPos The original position for the step in the Op Map. 02460 * @param score The current match score for the context node. 02461 * @return The resulting match score 02462 */ 02463 eMatchScore 02464 doStepPredicate( 02465 XPathExecutionContext& executionContext, 02466 XalanNode* context, 02467 OpCodeMapPositionType opPos, 02468 OpCodeMapPositionType startOpPos, 02469 eMatchScore score) const; 02470 02471 /** 02472 * Execute a step in a match pattern's location path. 02473 * 02474 * @param xpath The xpath that is executing 02475 * @param context The current source tree context node 02476 * @param opPos The current position in the xpath operation map array 02477 * @param scoreHolder a reference to an eMatchScore to receive 02478 * the result. 02479 * @return the last matched context node 02480 */ 02481 XalanNode* 02482 stepPattern( 02483 XPathExecutionContext& executionContext, 02484 XalanNode* context, 02485 OpCodeMapPositionType opPos, 02486 eMatchScore& scoreHolder) const; 02487 02488 OpCodeMapPositionType 02489 findNodeSet( 02490 XPathExecutionContext& executionContext, 02491 XalanNode* context, 02492 OpCodeMapPositionType opPos, 02493 OpCodeMapValueType stepType, 02494 MutableNodeRefList& subQueryResults) const; 02495 02496 OpCodeMapPositionType 02497 findRoot( 02498 XPathExecutionContext& executionContext, 02499 XalanNode* context, 02500 OpCodeMapPositionType opPos, 02501 OpCodeMapValueType stepType, 02502 MutableNodeRefList& subQueryResults) const; 02503 02504 OpCodeMapPositionType 02505 findParent( 02506 XPathExecutionContext& executionContext, 02507 XalanNode* context, 02508 OpCodeMapPositionType opPos, 02509 OpCodeMapValueType stepType, 02510 MutableNodeRefList& subQueryResults) const; 02511 02512 OpCodeMapPositionType 02513 findSelf( 02514 XPathExecutionContext& executionContext, 02515 XalanNode* context, 02516 OpCodeMapPositionType opPos, 02517 OpCodeMapValueType stepType, 02518 MutableNodeRefList& subQueryResults) const; 02519 02520 OpCodeMapPositionType 02521 findAncestors( 02522 XPathExecutionContext& executionContext, 02523 XalanNode* context, 02524 OpCodeMapPositionType opPos, 02525 OpCodeMapValueType stepType, 02526 MutableNodeRefList& subQueryResults) const; 02527 02528 OpCodeMapPositionType 02529 findAncestorsOrSelf( 02530 XPathExecutionContext& executionContext, 02531 XalanNode* context, 02532 OpCodeMapPositionType opPos, 02533 OpCodeMapValueType stepType, 02534 MutableNodeRefList& subQueryResults) const; 02535 02536 OpCodeMapPositionType 02537 findAttributes( 02538 XPathExecutionContext& executionContext, 02539 XalanNode* context, 02540 OpCodeMapPositionType opPos, 02541 OpCodeMapValueType stepType, 02542 MutableNodeRefList& subQueryResults) const; 02543 02544 OpCodeMapPositionType 02545 findChildren( 02546 XPathExecutionContext& executionContext, 02547 XalanNode* context, 02548 OpCodeMapPositionType opPos, 02549 OpCodeMapValueType stepType, 02550 MutableNodeRefList& subQueryResults) const; 02551 02552 OpCodeMapPositionType 02553 findDescendants( 02554 XPathExecutionContext& executionContext, 02555 XalanNode* context, 02556 OpCodeMapPositionType opPos, 02557 OpCodeMapValueType stepType, 02558 MutableNodeRefList& subQueryResults) const; 02559 02560 OpCodeMapPositionType 02561 findFollowing( 02562 XPathExecutionContext& executionContext, 02563 XalanNode* context, 02564 OpCodeMapPositionType opPos, 02565 OpCodeMapValueType stepType, 02566 MutableNodeRefList& subQueryResults) const; 02567 02568 OpCodeMapPositionType 02569 findFollowingSiblings( 02570 XPathExecutionContext& executionContext, 02571 XalanNode* context, 02572 OpCodeMapPositionType opPos, 02573 OpCodeMapValueType stepType, 02574 MutableNodeRefList& subQueryResults) const; 02575 02576 OpCodeMapPositionType 02577 findPreceeding( 02578 XPathExecutionContext& executionContext, 02579 XalanNode* context, 02580 OpCodeMapPositionType opPos, 02581 OpCodeMapValueType stepType, 02582 MutableNodeRefList& subQueryResults) const; 02583 02584 OpCodeMapPositionType 02585 findPreceedingSiblings( 02586 XPathExecutionContext& executionContext, 02587 XalanNode* context, 02588 OpCodeMapPositionType opPos, 02589 OpCodeMapValueType stepType, 02590 MutableNodeRefList& subQueryResults) const; 02591 02592 OpCodeMapPositionType 02593 findNamespace( 02594 XPathExecutionContext& executionContext, 02595 XalanNode* context, 02596 OpCodeMapPositionType opPos, 02597 OpCodeMapValueType stepType, 02598 MutableNodeRefList& subQueryResults) const; 02599 02600 OpCodeMapPositionType 02601 findNodesOnUnknownAxis( 02602 XPathExecutionContext& executionContext, 02603 XalanNode* context, 02604 OpCodeMapPositionType opPos, 02605 OpCodeMapValueType stepType, 02606 MutableNodeRefList& subQueryResults) const; 02607 02608 OpCodeMapPositionType 02609 predicates( 02610 XPathExecutionContext& executionContext, 02611 OpCodeMapPositionType opPos, 02612 MutableNodeRefList& subQueryResults) const; 02613 02614 eMatchScore 02615 handleFoundIndex( 02616 XPathExecutionContext& executionContext, 02617 XalanNode* localContext, 02618 OpCodeMapPositionType startOpPos) const; 02619 02620 eMatchScore 02621 handleFoundIndexPositional( 02622 XPathExecutionContext& executionContext, 02623 XalanNode* localContext, 02624 OpCodeMapPositionType startOpPos) const; 02625 02626 private: 02627 02628 void 02629 unknownOpCodeError( 02630 XalanNode* context, 02631 XPathExecutionContext& executionContext, 02632 OpCodeMapPositionType opPos) const; 02633 02634 void 02635 notNodeSetError( 02636 XalanNode* context, 02637 XPathExecutionContext& executionContext) const; 02638 02639 // Data members... 02640 02641 /** 02642 * 02643 * Holds information about the current expression. 02644 * 02645 */ 02646 XPathExpression m_expression; 02647 02648 /** 02649 * A Locator for reporting errors. 02650 */ 02651 const Locator* m_locator; 02652 02653 /** 02654 * If true, the XPath can allocated XObjects in more 02655 * efficient ways, since its lifetime is guaranteed 02656 * to be at least that of the transformation. 02657 */ 02658 bool m_inStylesheet; 02659 02660 /** 02661 * 02662 * This is the table of installed functions. 02663 * 02664 */ 02665 static FunctionTableType s_functions; 02666 02667 static const XalanDOMString s_emptyString; 02668 }; 02669 02670 02671 02672 XALAN_CPP_NAMESPACE_END 02673 02674 02675 02676 #endif // XPATH_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|