Xalan-C++ API Reference 1.12.0
XPath.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XPATH_HEADER_GUARD_1357924680)
19#define XPATH_HEADER_GUARD_1357924680
20
21
22
23// Base header file. Must be first.
25
26
27
29
30
31
33
34
35
36// Base class header files...
38
39
40
45
46
47
48namespace XERCES_CPP_NAMESPACE
49{
50 class Locator;
51}
52
53
54
55namespace XALAN_CPP_NAMESPACE {
56
57
58
59class PrefixResolver;
60class XObject;
61class XalanElement;
62class XalanNode;
63class XPathConstructionContext;
64
65
66
68{
69public:
70
71 typedef xercesc::Locator LocatorType;
72
79
80
81 static const XalanDOMChar PSEUDONAME_ANY[];
82 static const XalanDOMChar PSEUDONAME_ROOT[];
83 static const XalanDOMChar PSEUDONAME_TEXT[];
84 static const XalanDOMChar PSEUDONAME_COMMENT[];
85 static const XalanDOMChar PSEUDONAME_PI[];
86 static const XalanDOMChar PSEUDONAME_OTHER[];
87 static const XalanDOMChar PSEUDONAME_NODE[];
88
90 {
95 eMatchScoreOther
96 };
97
99 {
100 public:
101
102 enum eTargetType { eAttribute, eElement, eAny, eOther };
103
105 m_string(0),
106 m_priority(eMatchScoreNone),
107 m_targetType(eOther)
108 {
109 }
110
112 const XalanDOMChar* theString,
113 eMatchScore thePriority,
114 eTargetType theTargetType) :
115 m_string(theString),
116 m_priority(thePriority),
117 m_targetType(theTargetType)
118 {
119 }
120
121 const XalanDOMChar*
122 getString() const
123 {
124 return m_string;
125 }
126
129 {
130 return m_priority;
131 }
132
133 eTargetType
135 {
136 return m_targetType;
137 }
138
139 private:
140
141 const XalanDOMChar* m_string;
142
143 eMatchScore m_priority;
144
145 eTargetType m_targetType;
146 };
147
149
150 /**
151 * Perform static initialization. See class XPathInit.
152 */
153 static void
154 initialize(MemoryManager& theManager);
155
156 /**
157 * Perform static shut down. See class XPathInit.
158 */
159 static void
161
162 /**
163 * Construct an XPath.
164 *
165 * @param theLocator The applicable Locator, if any.
166 */
167 explicit
169 MemoryManager& theManager,
170 const Locator* theLocator = 0);
171
172 static XPath*
174 MemoryManager& theManager,
175 const Locator* theLocator = 0);
176
177 MemoryManager&
179 {
180 return m_expression.getMemoryManager();
181 }
182
184
185 /**
186 * Shrink internal tables.
187 */
188 void
190 {
191 m_expression.shrink();
192 }
193
194 /**
195 * Execute the XPath from the provided context.
196 *
197 * @param context current source tree context node, which must not be 0
198 * @param prefixResolver prefix resolver to use
199 * @param executionContext current execution context
200 * @return smart-pointer to result XObject
201 */
202 const XObjectPtr
204 XalanNode* context,
205 const PrefixResolver& prefixResolver,
206 XPathExecutionContext& executionContext) const;
207
208 /**
209 * Execute the XPath from the provided context.
210 *
211 * @param context current source tree context node, which must not be 0
212 * @param prefixResolver prefix resolver to use
213 * @param executionContext current execution context
214 * @param result the boolean result
215 */
216 void
218 XalanNode* context,
219 const PrefixResolver& prefixResolver,
220 XPathExecutionContext& executionContext,
221 bool& result) const;
222
223 /**
224 * Execute the XPath from the provided context.
225 *
226 * @param context current source tree context node, which must not be 0
227 * @param prefixResolver prefix resolver to use
228 * @param executionContext current execution context
229 * @param result the numeric result
230 */
231 void
233 XalanNode* context,
234 const PrefixResolver& prefixResolver,
235 XPathExecutionContext& executionContext,
236 double& result) const;
237
238 /**
239 * Execute the XPath from the provided context. The
240 * result is appended to the supplied string.
241 *
242 * @param context current source tree context node, which must not be 0
243 * @param prefixResolver prefix resolver to use
244 * @param executionContext current execution context
245 * @param result the string result
246 */
247 void
249 XalanNode* context,
250 const PrefixResolver& prefixResolver,
251 XPathExecutionContext& executionContext,
252 XalanDOMString& result) const;
253
254 typedef void (FormatterListener::*MemberFunctionPtr)(const XMLCh* const, const FormatterListener::size_type);
255
256 /**
257 * Execute the XPath from the provided context.
258 *
259 * @param context current source tree context node, which must not be 0
260 * @param prefixResolver prefix resolver to use
261 * @param executionContext current execution context
262 * @param formatterListener the FormatterListener instance to receive the result
263 * @param function A pointer to the member function of FormatterListener to call
264 */
265 void
267 XalanNode* context,
268 const PrefixResolver& prefixResolver,
269 XPathExecutionContext& executionContext,
270 FormatterListener& formatterListener,
271 MemberFunctionPtr function) const;
272
273 /**
274 * Execute the XPath from the provided context. Normally,
275 * the expression will be evaluated and the result placed
276 * in the parameter result. However, some cases (such as
277 * the evalution of a variable) could result in the copying
278 * of a node-set, which is extremely expensive. In that
279 * case, the return value will contain the result of the
280 * evaluation. If the call to XObject::null() on the return
281 * value is true, that indicates the value was executed
282 * directly into the parameter. Otherwise, the parameter
283 * will be empty, and the result will be in the XObject
284 * instance returned.
285 *
286 * @param context current source tree context node, which must not be 0
287 * @param prefixResolver prefix resolver to use
288 * @param executionContext current execution context
289 * @param result the node-set result
290 * @return the node-set result, if the result was not returned in the parameter
291 */
292 const XObjectPtr
294 XalanNode* context,
295 const PrefixResolver& prefixResolver,
296 XPathExecutionContext& executionContext,
297 MutableNodeRefList& result) const;
298
299 /**
300 * Execute the XPath from the provided context.
301 *
302 * @param context current source tree context node, which must not be 0
303 * @param prefixResolver prefix resolver to use
304 * @param contextNodeList node list for current context
305 * @param executionContext current execution context
306 * @return smart-pointer to result XObject
307 */
308 const XObjectPtr
310 XalanNode* context,
311 const PrefixResolver& prefixResolver,
312 const NodeRefListBase& contextNodeList,
313 XPathExecutionContext& executionContext) const
314 {
315 // Push and pop the context node list...
317 executionContext,
318 contextNodeList);
319
320 return execute(context, prefixResolver, executionContext);
321 }
322
323 /**
324 * Execute the XPath from the provided context.
325 *
326 * @param context current source tree context node, which must not be 0
327 * @param prefixResolver prefix resolver to use
328 * @param contextNodeList node list for current context
329 * @param executionContext current execution context
330 * @param result the boolean result
331 */
332 void
334 XalanNode* context,
335 const PrefixResolver& prefixResolver,
336 const NodeRefListBase& contextNodeList,
337 XPathExecutionContext& executionContext,
338 bool& result) const
339 {
340 // Push and pop the context node list...
342 executionContext,
343 contextNodeList);
344
345 execute(context, prefixResolver, executionContext, result);
346 }
347
348 /**
349 * Execute the XPath from the provided context.
350 *
351 * @param context current source tree context node, which must not be 0
352 * @param prefixResolver prefix resolver to use
353 * @param contextNodeList node list for current context
354 * @param executionContext current execution context
355 * @param result the numeric result
356 */
357 void
359 XalanNode* context,
360 const PrefixResolver& prefixResolver,
361 const NodeRefListBase& contextNodeList,
362 XPathExecutionContext& executionContext,
363 double& result) const
364 {
365 // Push and pop the context node list...
367 executionContext,
368 contextNodeList);
369
370 execute(context, prefixResolver, executionContext, result);
371 }
372
373 /**
374 * Execute the XPath from the provided context. The
375 * result is appended to the supplied string.
376 *
377 * @param context current source tree context node, which must not be 0
378 * @param prefixResolver prefix resolver to use
379 * @param contextNodeList node list for current context
380 * @param executionContext current execution context
381 * @param result the string result
382 */
383 void
385 XalanNode* context,
386 const PrefixResolver& prefixResolver,
387 const NodeRefListBase& contextNodeList,
388 XPathExecutionContext& executionContext,
389 XalanDOMString& result) const
390 {
391 // Push and pop the context node list...
393 executionContext,
394 contextNodeList);
395
396 execute(context, prefixResolver, executionContext, result);
397 }
398
399 /**
400 * Execute the XPath from the provided context.
401 *
402 * @param context current source tree context node, which must not be 0
403 * @param prefixResolver prefix resolver to use
404 * @param contextNodeList node list for current context
405 * @param executionContext current execution context
406 * @param formatterListener the FormatterListener instance to receive the result
407 * @param function A pointer to the member function of FormatterListener to call
408 */
409 void
411 XalanNode* context,
412 const PrefixResolver& prefixResolver,
413 const NodeRefListBase& contextNodeList,
414 XPathExecutionContext& executionContext,
415 FormatterListener& formatterListener,
416 MemberFunctionPtr function) const
417 {
418 // Push and pop the context node list...
420 executionContext,
421 contextNodeList);
422
423 execute(context, prefixResolver, executionContext, formatterListener, function);
424 }
425
426 /**
427 * Execute the XPath from the provided context. Normally,
428 * the expression will be evaluated and the result placed
429 * in the parameter result. However, some cases (such as
430 * the evalution of a variable) could result in the copying
431 * of a node-set, which is extremely expensive. In that
432 * case, the return value will contain the result of the
433 * evaluation. If the call to XObject::null() on the return
434 * value is true, that indicates the value was executed
435 * directly into the parameter. Otherwise, the parameter
436 * will be empty, and the result will be in the XObject
437 * instance returned.
438 *
439 * @param context current source tree context node, which must not be 0
440 * @param prefixResolver prefix resolver to use
441 * @param contextNodeList node list for current context
442 * @param executionContext current execution context
443 * @param result the result as a set of nodes
444 * @return the node-set result, if the result was not returned in the parameter
445 */
446 const XObjectPtr
448 XalanNode* context,
449 const PrefixResolver& prefixResolver,
450 const NodeRefListBase& contextNodeList,
451 XPathExecutionContext& executionContext,
452 MutableNodeRefList& result) const
453 {
454 // Push and pop the context node list...
456 executionContext,
457 contextNodeList);
458
459 return execute(context, prefixResolver, executionContext, result);
460 }
461
462 /**
463 * Execute the XPath from the provided context.
464 *
465 * The prefix resolver and current node must already
466 * be set execution context, and must not be 0.
467 *
468 * @param executionContext current execution context
469 * @return smart-pointer to result XObject
470 */
471 const XObjectPtr
472 execute(XPathExecutionContext& executionContext) const
473 {
474 assert(executionContext.getCurrentNode() != 0);
475 assert(executionContext.getPrefixResolver() != 0);
476
477 return executeMore(
478 executionContext.getCurrentNode(),
479 getInitialOpCodePosition(),
480 executionContext);
481 }
482
483 /**
484 * Execute the XPath from the provided context.
485 *
486 * The prefix resolver and current node must already
487 * be set execution context, and must not be 0.
488 *
489 * @param executionContext current execution context
490 * @param result the boolean result
491 */
492 void
494 XPathExecutionContext& executionContext,
495 bool& result) const
496 {
497 assert(executionContext.getCurrentNode() != 0);
498 assert(executionContext.getPrefixResolver() != 0);
499
500 executeMore(
501 executionContext.getCurrentNode(),
502 getInitialOpCodePosition(),
503 executionContext,
504 result);
505 }
506
507 /**
508 * Execute the XPath from the provided context.
509 *
510 * The prefix resolver must already be set in the
511 * execution context.
512 *
513 * @param executionContext current execution context
514 * @param result the numeric result
515 */
516 void
518 XPathExecutionContext& executionContext,
519 double& result) const
520 {
521 assert(executionContext.getCurrentNode() != 0);
522 assert(executionContext.getPrefixResolver() != 0);
523
524 executeMore(
525 executionContext.getCurrentNode(),
526 getInitialOpCodePosition(),
527 executionContext,
528 result);
529 }
530
531 /**
532 * Execute the XPath from the provided context. The
533 * result is appended to the supplied string.
534 *
535 * The prefix resolver and current node must already
536 * be set execution context, and must not be 0.
537 *
538 * @param executionContext current execution context
539 * @param result the string result
540 */
541 void
543 XPathExecutionContext& executionContext,
544 XalanDOMString& result) const
545 {
546 assert(executionContext.getCurrentNode() != 0);
547 assert(executionContext.getPrefixResolver() != 0);
548
549 executeMore(
550 executionContext.getCurrentNode(),
551 getInitialOpCodePosition(),
552 executionContext,
553 result);
554 }
555
556 /**
557 * Execute the XPath from the provided context.
558 *
559 * The prefix resolver and current node must already
560 * be set execution context, and must not be 0.
561 *
562 * @param executionContext current execution context
563 * @param formatterListener the FormatterListener instance to receive the result
564 * @param function A pointer to the member function of FormatterListener to call
565 */
566 void
568 XPathExecutionContext& executionContext,
569 FormatterListener& formatterListener,
570 MemberFunctionPtr function) const
571 {
572 assert(executionContext.getCurrentNode() != 0);
573 assert(executionContext.getPrefixResolver() != 0);
574
575 executeMore(
576 executionContext.getCurrentNode(),
577 getInitialOpCodePosition(),
578 executionContext,
579 formatterListener,
580 function);
581 }
582
583 /**
584 * Execute the XPath from the provided context. Normally,
585 * the expression will be evaluated and the result placed
586 * in the parameter result. However, some cases (such as
587 * the evalution of a variable) could result in the copying
588 * of a node-set, which is extremely expensive. In that
589 * case, the return value will contain the result of the
590 * evaluation. If the call to XObject::null() on the return
591 * value is true, that indicates the value was executed
592 * directly into the parameter. Otherwise, the parameter
593 * will be empty, and the result will be in the XObject
594 * instance returned.
595 *
596 * The prefix resolver and current node must already
597 * be set execution context, and must not be 0.
598 *
599 * @param executionContext current execution context
600 * @param result A node list for the result. This may or may not contain the actual result.
601 * @return the node-set result, if the result was not returned in the parameter
602 */
603 const XObjectPtr
605 XPathExecutionContext& executionContext,
606 MutableNodeRefList& result) const
607 {
608 assert(executionContext.getCurrentNode() != 0);
609 assert(executionContext.getPrefixResolver() != 0);
610
611 return executeMore(
612 executionContext.getCurrentNode(),
613 getInitialOpCodePosition(),
614 executionContext,
615 result);
616 }
617
618 /**
619 * Execute the XPath from the provided context.
620 *
621 * The current node must already be set execution context,
622 * and must not be 0.
623 *
624 * @param executionContext current execution context
625 * @param prefixResolver prefix resolver to use
626 * @return smart-pointer to result XObject
627 */
628 const XObjectPtr
630 const PrefixResolver& prefixResolver,
631 XPathExecutionContext& executionContext) const
632 {
633 assert(executionContext.getCurrentNode() != 0);
634
635 // Push and pop the PrefixResolver...
636 const PrefixResolverSetAndRestore theResolverSetAndRestore(
637 executionContext,
638 &prefixResolver);
639
640 return executeMore(
641 executionContext.getCurrentNode(),
642 getInitialOpCodePosition(),
643 executionContext);
644 }
645
646 /**
647 * Execute the XPath from the provided context.
648 *
649 * The current node must already be set execution context,
650 * and must not be 0.
651 *
652 * @param executionContext current execution context
653 * @param prefixResolver prefix resolver to use
654 * @param result the boolean result
655 */
656 void
658 const PrefixResolver& prefixResolver,
659 XPathExecutionContext& executionContext,
660 bool& result) const
661 {
662 assert(executionContext.getCurrentNode() != 0);
663
664 // Push and pop the PrefixResolver...
665 const PrefixResolverSetAndRestore theResolverSetAndRestore(
666 executionContext,
667 &prefixResolver);
668
669 executeMore(
670 executionContext.getCurrentNode(),
671 getInitialOpCodePosition(),
672 executionContext,
673 result);
674 }
675
676 /**
677 * Execute the XPath from the provided context.
678 *
679 * The current node must already be set execution context,
680 * and must not be 0.
681 *
682 * @param executionContext current execution context
683 * @param prefixResolver prefix resolver to use
684 * @param result the numeric result
685 */
686 void
688 const PrefixResolver& prefixResolver,
689 XPathExecutionContext& executionContext,
690 double& result) const
691 {
692 assert(executionContext.getCurrentNode() != 0);
693
694 // Push and pop the PrefixResolver...
695 const PrefixResolverSetAndRestore theResolverSetAndRestore(
696 executionContext,
697 &prefixResolver);
698
699 executeMore(
700 executionContext.getCurrentNode(),
701 getInitialOpCodePosition(),
702 executionContext,
703 result);
704 }
705
706 /**
707 * Execute the XPath from the provided context. The
708 * result is appended to the supplied string.
709 *
710 * The current node must already be set execution context,
711 * and must not be 0.
712 *
713 * @param executionContext current execution context
714 * @param prefixResolver prefix resolver to use
715 * @param result the string result
716 */
717 void
719 const PrefixResolver& prefixResolver,
720 XPathExecutionContext& executionContext,
721 XalanDOMString& result) const
722 {
723 assert(executionContext.getCurrentNode() != 0);
724
725 // Push and pop the PrefixResolver...
726 const PrefixResolverSetAndRestore theResolverSetAndRestore(
727 executionContext,
728 &prefixResolver);
729
730 executeMore(
731 executionContext.getCurrentNode(),
732 getInitialOpCodePosition(),
733 executionContext,
734 result);
735 }
736
737 /**
738 * Execute the XPath from the provided context.
739 *
740 * @param prefixResolver prefix resolver to use
741 * @param executionContext current execution context
742 * @param formatterListener the FormatterListener instance to receive the result
743 * @param function A pointer to the member function of FormatterListener to call
744 */
745 void
747 const PrefixResolver& prefixResolver,
748 XPathExecutionContext& executionContext,
749 FormatterListener& formatterListener,
750 MemberFunctionPtr function) const
751 {
752 assert(executionContext.getCurrentNode() != 0);
753
754 // Push and pop the PrefixResolver...
755 const PrefixResolverSetAndRestore theResolverSetAndRestore(
756 executionContext,
757 &prefixResolver);
758
759 executeMore(
760 executionContext.getCurrentNode(),
761 getInitialOpCodePosition(),
762 executionContext,
763 formatterListener,
764 function);
765 }
766
767 /**
768 * Execute the XPath from the provided context. Normally,
769 * the expression will be evaluated and the result placed
770 * in the parameter result. However, some cases (such as
771 * the evalution of a variable) could result in the copying
772 * of a node-set, which is extremely expensive. In that
773 * case, the return value will contain the result of the
774 * evaluation. If the call to XObject::null() on the return
775 * value is true, that indicates the value was executed
776 * directly into the parameter. Otherwise, the parameter
777 * will be empty, and the result will be in the XObject
778 * instance returned.
779 *
780 * The current node must already be set execution context,
781 * and must not be 0.
782 *
783 * @param executionContext current execution context
784 * @param prefixResolver prefix resolver to use
785 * @param result A node list for the result. This may or may not contain the actual result.
786 * @return the node-set result, if the result was not returned in the parameter
787 */
790 const PrefixResolver& prefixResolver,
791 XPathExecutionContext& executionContext,
792 MutableNodeRefList& result) const
793 {
794 assert(executionContext.getCurrentNode() != 0);
795
796 // Push and pop the PrefixResolver...
797 const PrefixResolverSetAndRestore theResolverSetAndRestore(
798 executionContext,
799 &prefixResolver);
800
801 return executeMore(
802 executionContext.getCurrentNode(),
803 getInitialOpCodePosition(),
804 executionContext,
805 result);
806 }
807
808 /**
809 * Retrieve a reference to the current expression.
810 *
811 * @return current expression
812 */
815 {
816 return m_expression;
817 }
818
819 /**
820 * Retrieve a reference to the current expression.
821 *
822 * @return current expression
823 */
824 const XPathExpression&
826 {
827 return m_expression;
828 }
829
830 static double
832 {
833 switch(score)
834 {
835 case eMatchScoreNone:
836 return DoubleSupport::getNegativeInfinity();
837 break;
838
839 case eMatchScoreNodeTest:
840 return -0.5;
841 break;
842
843 case eMatchScoreNSWild:
844 return -0.25;
845 break;
846
847 case eMatchScoreOther:
848 return 0.5;
849 break;
850
851 case eMatchScoreQName:
852 return 0.0;
853 break;
854 };
855
856 assert(false);
857 return 0.0;
858 }
859
860 /**
861 * Get the match score for the specified node.
862 *
863 * @param node The node for the score
864 * @param executionContext current execution context
865 * @return union of node-set operands
866 */
867 eMatchScore
869 XalanNode* node,
870 XPathExecutionContext& executionContext) const;
871
872 /**
873 * Get the match score for the specified node.
874 *
875 * @param node The node for the score
876 * @param resolver The prefix resolver
877 * @param executionContext current execution context
878 * @return union of node-set operands
879 */
882 XalanNode* node,
883 const PrefixResolver& resolver,
884 XPathExecutionContext& executionContext) const;
885
886 /**
887 * Evaluate a predicate.
888 *
889 * @param context current source tree context node
890 * @param opPos current position in the Op Map
891 * @param executionContext current execution context
892 * @return pointer to either a boolean or a number
893 */
894 const XObjectPtr
896 XalanNode* context,
898 XPathExecutionContext& executionContext) const
899 {
900 return executeMore(context, opPos + 2, executionContext);
901 }
902
903 /**
904 * Add the data for the target of match pattern to a vector.
905 *
906 * @param targetData The vector for the data
907 */
908 void
910
911 /**
912 * Install a built-in function.
913 *
914 * @param funcName unqualified name of the function
915 * @param func instance of an XPath function object
916 */
917 static void
919 const XalanDOMString& funcName,
920 const Function& func)
921 {
922 s_functions.InstallFunction(funcName,
923 func);
924 }
925
926 /**
927 * Install a built-in function.
928 *
929 * @param funcName unqualified name of the function
930 * @param func instance of an XPath function object
931 */
932 static void
934 const XalanDOMChar* funcName,
935 const Function& func)
936 {
937 s_functions.InstallFunction(funcName,
938 func);
939 }
940
941 /**
942 * Remove a named function from the function table.
943 *
944 * @param funcName name of function
945 * @return true if the function was found and removed.
946 */
947 static bool
949 {
950 return s_functions.UninstallFunction(funcName);
951 }
952
953 /**
954 * Remove a named function from the function table.
955 *
956 * @param funcName name of function
957 * @return true if the function was found and removed.
958 */
959 static bool
960 uninstallFunction(const XalanDOMChar* funcName)
961 {
962 return s_functions.UninstallFunction(funcName);
963 }
964
965 /**
966 * Whether the named function is installed in the function table.
967 *
968 * @param name of function
969 * @return true if the function has been installed
970 */
971 static bool
972 isInstalledFunction(const XalanDOMString& theFunctionName)
973 {
974 return s_functions.isInstalledFunction(theFunctionName);
975 }
976
978
979 /**
980 * Retrieve the table of installed functions.
981 *
982 * @return function table
983 */
984 static const FunctionTableType&
986 {
987 return s_functions;
988 }
989
990 /**
991 * Add the names for the installed functions to a vector strings.
992 *
993 * @param theIterator vector added to
994 */
995 template<class OutputIteratorType>
996 static void
997 getInstalledFunctionNames(OutputIteratorType theIterator)
998 {
999 s_functions.getInstalledFunctionNames(theIterator);
1000 }
1001
1002 static void
1004 {
1005 s_functions.DestroyTable();
1006 }
1007
1008 bool
1010 {
1011 return m_inStylesheet;
1012 }
1013
1014 void
1015 setInStylesheet(bool fValue)
1016 {
1017 m_inStylesheet = fValue;
1018 }
1019
1020 const Locator*
1022 {
1023 return m_locator;
1024 }
1025
1026 void
1027 setLocator(const Locator* theLocator)
1028 {
1029 m_locator = theLocator;
1030 }
1031
1033 {
1034 public:
1035
1037
1038 NodeTester(const NodeTester& theSource);
1039
1041 const XPath& xpath,
1042 XPathExecutionContext& executionContext,
1044 OpCodeMapValueType argLen,
1045 OpCodeMapValueType stepType);
1046
1048 XPathConstructionContext& theContext,
1049 const XalanDOMString& theNameTest,
1050 const PrefixResolver& thePrefixResolver,
1051 const Locator* theLocator = 0,
1052 eMatchScore* theMatchScore = 0);
1053
1055 const XalanDOMString& theNamespaceURI,
1056 const XalanDOMString& theLocalName,
1057 eMatchScore* theMatchScore = 0);
1058
1061 const XalanNode& context,
1062 XalanNode::NodeType nodeType) const
1063 {
1064 assert(context.getNodeType() == nodeType);
1065
1066 return (this->*m_testFunction)(context, nodeType);
1067 }
1068
1070 operator()(const XalanElement& context) const
1071 {
1072 return (this->*m_testFunction2)(context);
1073 }
1074
1075 NodeTester&
1076 operator=(const NodeTester& theRHS)
1077 {
1078 m_executionContext = theRHS.m_executionContext;
1079 m_targetNamespace = theRHS.m_targetNamespace;
1080 m_targetLocalName = theRHS.m_targetLocalName;
1081 m_testFunction = theRHS.m_testFunction;
1082 m_testFunction2 = theRHS.m_testFunction2;
1083
1084 return *this;
1085 }
1086
1087 protected:
1088
1091 XPathConstructionContext& theConstructionContext,
1092 const XalanDOMString& theNameTest,
1093 const PrefixResolver& thePrefixResolver,
1094 const Locator* theLocator);
1095
1098 const XalanDOMString& theNamespaceURI,
1099 const XalanDOMString& theLocalName);
1100
1101 private:
1102
1103
1104 typedef eMatchScore (NodeTester::*TestFunctionPtr)(const XalanNode&, XalanNode::NodeType) const;
1105 typedef eMatchScore (NodeTester::*TestFunctionPtr2)(const XalanElement&) const;
1106
1107
1109 testComment(
1110 const XalanNode& context,
1111 XalanNode::NodeType nodeType) const;
1112
1114 testText(
1115 const XalanNode& context,
1116 XalanNode::NodeType nodeType) const;
1117
1119 testPI(
1120 const XalanNode& context,
1121 XalanNode::NodeType nodeType) const;
1122
1124 testPIName(
1125 const XalanNode& context,
1126 XalanNode::NodeType nodeType) const;
1127
1129 testNode(
1130 const XalanNode& context,
1131 XalanNode::NodeType nodeType) const;
1132
1134 testRoot(
1135 const XalanNode& context,
1136 XalanNode::NodeType nodeType) const;
1137
1139 testAttributeNCName(
1140 const XalanNode& context,
1141 XalanNode::NodeType nodeType) const;
1142
1144 testAttributeQName(
1145 const XalanNode& context,
1146 XalanNode::NodeType nodeType) const;
1147
1149 testAttributeNamespaceOnly(
1150 const XalanNode& context,
1151 XalanNode::NodeType nodeType) const;
1152
1154 testAttributeTotallyWild(
1155 const XalanNode& context,
1156 XalanNode::NodeType nodeType) const;
1157
1159 testElementNCName(
1160 const XalanNode& context,
1161 XalanNode::NodeType nodeType) const;
1162
1164 testElementQName(
1165 const XalanNode& context,
1166 XalanNode::NodeType nodeType) const;
1167
1169 testElementNamespaceOnly(
1170 const XalanNode& context,
1171 XalanNode::NodeType nodeType) const;
1172
1174 testElementTotallyWild(
1175 const XalanNode& context,
1176 XalanNode::NodeType nodeType) const;
1177
1179 testElementNCName2(const XalanElement& context) const;
1180
1182 testElementQName2(const XalanElement& context) const;
1183
1185 testElementNamespaceOnly2(const XalanElement& context) const;
1186
1188 testElementTotallyWild2(const XalanElement& context) const;
1189
1191 testNamespaceNCName(
1192 const XalanNode& context,
1193 XalanNode::NodeType nodeType) const;
1194
1196 testNamespaceTotallyWild(
1197 const XalanNode& context,
1198 XalanNode::NodeType nodeType) const;
1199
1201 testDefault(
1202 const XalanNode& context,
1203 XalanNode::NodeType nodeType) const;
1204
1206 testDefault2(const XalanElement& context) const;
1207
1208 bool
1209 matchLocalName(const XalanNode& context) const;
1210
1211 bool
1212 matchNamespaceURI(const XalanNode& context) const;
1213
1214 bool
1215 matchLocalNameAndNamespaceURI(const XalanNode& context) const;
1216
1217 bool
1218 matchNamespace(const XalanNode& context) const;
1219
1220 bool
1221 shouldStripSourceNode(const XalanText& context) const;
1222
1223 // Data members...
1224 XPathExecutionContext* m_executionContext;
1225
1226 const XalanDOMString* m_targetNamespace;
1227
1228 const XalanDOMString* m_targetLocalName;
1229
1230 TestFunctionPtr m_testFunction;
1231
1232 TestFunctionPtr2 m_testFunction2;
1233 };
1234
1235 friend class NodeTester;
1236
1237protected:
1238
1239 /**
1240 * Execute a location path.
1241 *
1242 * @param context current source tree context node
1243 * @param opPos current position in the Op Mpa
1244 * @param executionContext current execution context
1245 * @return node-set
1246 */
1247 const XObjectPtr
1249 XalanNode* context,
1251 XPathExecutionContext& executionContext) const;
1252
1253 /**
1254 * Execute a location path.
1255 *
1256 * @param context current source tree context node
1257 * @param opPos current position in the Op Map
1258 * @param executionContext current execution context
1259 * @param theResult the result as a node list
1260 */
1261 void
1263 XalanNode* context,
1265 XPathExecutionContext& executionContext,
1266 bool& theResult) const;
1267
1268 /**
1269 * Execute a location path.
1270 *
1271 * @param context current source tree context node
1272 * @param opPos current position in the Op Map
1273 * @param executionContext current execution context
1274 * @param theResult the result as a node list
1275 */
1276 void
1278 XalanNode* context,
1280 XPathExecutionContext& executionContext,
1281 double& theResult) const;
1282
1283 /**
1284 * Execute a location path.
1285 *
1286 * @param context current source tree context node
1287 * @param opPos current position in the Op Map
1288 * @param executionContext current execution context
1289 * @param theResult the result as a node list
1290 */
1291 void
1293 XalanNode* context,
1295 XPathExecutionContext& executionContext,
1296 XalanDOMString& theResult) const;
1297
1298 /**
1299 * Execute a location path.
1300 *
1301 * @param context current source tree context node
1302 * @param opPos current position in the Op Map
1303 * @param executionContext current execution context
1304 * @param formatterListener the FormatterListener instance to receive the result
1305 * @param function A pointer to the member function of FormatterListener to call
1306 */
1307 void
1309 XalanNode* context,
1311 XPathExecutionContext& executionContext,
1312 FormatterListener& formatterListener,
1313 MemberFunctionPtr function) const;
1314
1315 /**
1316 * Execute a location path.
1317 *
1318 * @param context current source tree context node
1319 * @param opPos current position in the Op Map
1320 * @param executionContext current execution context
1321 * @param theResult the result as a node list
1322 */
1323 void
1325 XalanNode* context,
1327 XPathExecutionContext& executionContext,
1328 MutableNodeRefList& theResult) const
1329 {
1330 step(executionContext, context, opPos + 2, theResult);
1331 }
1332
1333 /**
1334 * Execute the XPath from the provided context.
1335 *
1336 * @param context current source tree context node
1337 * @param opPos current position in the Op Map
1338 * @param executionContext current execution context
1339 * @return pointer to union of node-set operands
1340 */
1341 const XObjectPtr
1343 XalanNode* context,
1345 XPathExecutionContext& executionContext) const;
1346
1347 /**
1348 * Execute the XPath from the provided context.
1349 *
1350 * @param context current source tree context node
1351 * @param opPos current position in the Op Map
1352 * @param executionContext current execution context
1353 * @param theResult The result of the execution
1354 */
1355 void
1357 XalanNode* context,
1359 XPathExecutionContext& executionContext,
1360 bool& theResult) const;
1361
1362 /**
1363 * Execute the XPath from the provided context.
1364 *
1365 * @param context current source tree context node
1366 * @param opPos current position in the Op Map
1367 * @param executionContext current execution context
1368 * @param theResult The result of the execution
1369 */
1370 void
1372 XalanNode* context,
1374 XPathExecutionContext& executionContext,
1375 double& theResult) const;
1376
1377 /**
1378 * Execute the XPath from the provided context. The result
1379 * is appended to the supplied string.
1380 *
1381 * @param context current source tree context node
1382 * @param opPos current position in the Op Map
1383 * @param executionContext current execution context
1384 * @param theResult The result of the execution
1385 */
1386 void
1388 XalanNode* context,
1390 XPathExecutionContext& executionContext,
1391 XalanDOMString& theResult) const;
1392
1393 /**
1394 * Execute the XPath from the provided context.
1395 *
1396 * @param context current source tree context node
1397 * @param opPos current position in the Op Map
1398 * @param executionContext current execution context
1399 * @param formatterListener the FormatterListener instance to receive the result
1400 * @param function A pointer to the member function of FormatterListener to call
1401 */
1402 void
1404 XalanNode* context,
1406 XPathExecutionContext& executionContext,
1407 FormatterListener& formatterListener,
1408 MemberFunctionPtr function) const;
1409
1410 /**
1411 * Execute the XPath from the provided context.
1412 *
1413 * @param context current source tree context node
1414 * @param opPos current position in the Op Map
1415 * @param executionContext current execution context
1416 * @param theResult The result of the execution
1417 * @return the node-set result, if the result was not returned in the parameter
1418 */
1419 const XObjectPtr
1421 XalanNode* context,
1423 XPathExecutionContext& executionContext,
1424 MutableNodeRefList& theResult) const;
1425
1426 /**
1427 * Helper function to get match score.
1428 * @param context The current source tree context node.
1429 * @param executionContext The current execution context
1430 * @param score The match score
1431 */
1432 void
1434 XalanNode* context,
1435 XPathExecutionContext& executionContext,
1436 eMatchScore& score) const;
1437
1438 /**
1439 * OR two expressions and return the boolean result.
1440 * @param context The current source tree context node.
1441 * @param opPos The current position in the Op Map.
1442 * @param executionContext current execution context
1443 * @return true if the one of the two arguments are true.
1444 */
1445 bool
1447 XalanNode* context,
1449 XPathExecutionContext& executionContext) const;
1450
1451 /**
1452 * OR two expressions and return the boolean result.
1453 * @param context The current source tree context node.
1454 * @param opPos The current position in the Op Map.
1455 * @param executionContext current execution context
1456 * @return true if the two arguments are both true.
1457 */
1458 bool
1460 XalanNode* context,
1462 XPathExecutionContext& executionContext) const;
1463
1464 /**
1465 * Tell if two expressions are functionally not equal.
1466 * @param context The current source tree context node.
1467 * @param opPos The current position in the Op Map.
1468 * @param executionContext current execution context
1469 * @return true if the two arguments are not equal.
1470 */
1471 bool
1473 XalanNode* context,
1475 XPathExecutionContext& executionContext) const;
1476
1477 /**
1478 * Tell if two expressions are functionally equal.
1479 * @param context The current source tree context node.
1480 * @param opPos The current position in the Op Map.
1481 * @param executionContext current execution context
1482 * @return true if the two arguments are equal.
1483 */
1484 bool
1486 XalanNode* context,
1488 XPathExecutionContext& executionContext) const;
1489
1490 /**
1491 * Tell if one argument is less than or equal to the other argument.
1492 * @param context The current source tree context node.
1493 * @param opPos The current position in the Op Map.
1494 * @param executionContext current execution context
1495 * @return true if arg 1 is less than or equal to arg 2.
1496 */
1497 bool
1499 XalanNode* context,
1501 XPathExecutionContext& executionContext) const;
1502
1503 /**
1504 * Tell if one argument is less than the other argument.
1505 * @param context The current source tree context node.
1506 * @param opPos The current position in the Op Map.
1507 * @param executionContext current execution context
1508 * @return true if arg 1 is less than arg 2.
1509 */
1510 bool
1512 XalanNode* context,
1514 XPathExecutionContext& executionContext) const;
1515
1516 /**
1517 * Tell if one argument is greater than or equal to the other argument.
1518 * @param context The current source tree context node.
1519 * @param opPos The current position in the Op Map.
1520 * @param executionContext current execution context
1521 * @return true if arg 1 is greater than or equal to arg 2.
1522 */
1523 bool
1525 XalanNode* context,
1527 XPathExecutionContext& executionContext) const;
1528
1529 /**
1530 * Tell if one argument is greater than the other argument.
1531 * @param context The current source tree context node.
1532 * @param opPos The current position in the Op Map.
1533 * @param executionContext current execution context
1534 * @return true if arg 1 is greater than arg 2.
1535 */
1536 bool
1538 XalanNode* context,
1540 XPathExecutionContext& executionContext) const;
1541
1542 /**
1543 * Give the sum of two arguments.
1544 * @param context The current source tree context node.
1545 * @param opPos The current position in the Op Map.
1546 * @param executionContext current execution context
1547 * @return sum of arg1 and arg2.
1548 */
1549 double
1551 XalanNode* context,
1553 XPathExecutionContext& executionContext) const;
1554
1555 /**
1556 * Give the sum of two arguments.
1557 * @param context The current source tree context node.
1558 * @param opPos The current position in the Op Map.
1559 * @param executionContext current execution context
1560 * @param formatterListener the FormatterListener instance to receive the result
1561 * @param function A pointer to the member function of FormatterListener to call
1562 */
1563 void
1565 XalanNode* context,
1567 XPathExecutionContext& executionContext,
1568 FormatterListener& formatterListener,
1569 MemberFunctionPtr function) const;
1570
1571 /**
1572 * Give the difference of two arguments.
1573 * @param context The current source tree context node.
1574 * @param opPos The current position in the Op Map.
1575 * @param executionContext current execution context
1576 * @return difference of arg1 and arg2.
1577 */
1578 double
1580 XalanNode* context,
1582 XPathExecutionContext& executionContext) const;
1583
1584 /**
1585 * Give the difference of two arguments.
1586 * @param context The current source tree context node.
1587 * @param opPos The current position in the Op Map.
1588 * @param executionContext current execution context
1589 * @param formatterListener the FormatterListener instance to receive the result
1590 * @param function A pointer to the member function of FormatterListener to call
1591 */
1592 void
1594 XalanNode* context,
1596 XPathExecutionContext& executionContext,
1597 FormatterListener& formatterListener,
1598 MemberFunctionPtr function) const;
1599
1600 /**
1601 * Multiply two arguments.
1602 * @param context The current source tree context node.
1603 * @param opPos The current position in the Op Map.
1604 * @param executionContext current execution context
1605 * @return arg1 * arg2.
1606 */
1607 double
1609 XalanNode* context,
1611 XPathExecutionContext& executionContext) const;
1612
1613 /**
1614 * Multiply two arguments.
1615 * @param context The current source tree context node.
1616 * @param opPos The current position in the Op Map.
1617 * @param executionContext current execution context
1618 * @param formatterListener the FormatterListener instance to receive the result
1619 * @param function A pointer to the member function of FormatterListener to call
1620 */
1621 void
1623 XalanNode* context,
1625 XPathExecutionContext& executionContext,
1626 FormatterListener& formatterListener,
1627 MemberFunctionPtr function) const;
1628
1629 /**
1630 * Divide a number.
1631 * @param context The current source tree context node.
1632 * @param opPos The current position in the Op Map.
1633 * @param executionContext current execution context
1634 * @return arg1 / arg2.
1635 */
1636 double
1638 XalanNode* context,
1640 XPathExecutionContext& executionContext) const;
1641
1642 /**
1643 * Divide a number.
1644 * @param context The current source tree context node.
1645 * @param opPos The current position in the Op Map.
1646 * @param executionContext current execution context
1647 * @param formatterListener the FormatterListener instance to receive the result
1648 * @param function A pointer to the member function of FormatterListener to call
1649 */
1650 void
1652 XalanNode* context,
1654 XPathExecutionContext& executionContext,
1655 FormatterListener& formatterListener,
1656 MemberFunctionPtr function) const;
1657
1658 /**
1659 * Return the remainder from a truncating division.
1660 * @param context The current source tree context node.
1661 * @param opPos The current position in the Op Map.
1662 * @param executionContext current execution context
1663 * @return arg1 mod arg2.
1664 */
1665 double
1667 XalanNode* context,
1669 XPathExecutionContext& executionContext) const;
1670
1671 /**
1672 * Return the remainder from a truncating division.
1673 * @param context The current source tree context node.
1674 * @param opPos The current position in the Op Map.
1675 * @param executionContext current execution context
1676 * @param formatterListener the FormatterListener instance to receive the result
1677 * @param function A pointer to the member function of FormatterListener to call
1678 */
1679 void
1681 XalanNode* context,
1683 XPathExecutionContext& executionContext,
1684 FormatterListener& formatterListener,
1685 MemberFunctionPtr function) const;
1686
1687 /**
1688 * Return the negation of a number.
1689 * @param context The current source tree context node.
1690 * @param opPos The current position in the Op Map.
1691 * @param executionContext current execution context
1692 * @return -arg.
1693 */
1694 double
1696 XalanNode* context,
1698 XPathExecutionContext& executionContext) const;
1699
1700 /**
1701 * Return the negation of a number.
1702 * @param context The current source tree context node.
1703 * @param opPos The current position in the Op Map.
1704 * @param executionContext current execution context
1705 * @param formatterListener the FormatterListener instance to receive the result
1706 * @param function A pointer to the member function of FormatterListener to call
1707 */
1708 void
1710 XalanNode* context,
1712 XPathExecutionContext& executionContext,
1713 FormatterListener& formatterListener,
1714 MemberFunctionPtr function) const;
1715
1716 /**
1717 * Computes the union of its operands which must be node-sets.
1718 * @param context The current source tree context node.
1719 * @param opPos The current position in the Op Map.
1720 * @param executionContext current execution context
1721 * @return the union of node-set operands.
1722 */
1723 const XObjectPtr
1725 XalanNode* context,
1727 XPathExecutionContext& executionContext) const;
1728
1729 /**
1730 * Computes the union of its operands which must be node-sets.
1731 *
1732 * @param context The current source tree context node.
1733 * @param opPos The current position in the Op Map.
1734 * @param executionContext current execution context
1735 * @result the result of the union of node-set operands.
1736 */
1737 void
1739 XalanNode* context,
1741 XPathExecutionContext& executionContext,
1742 bool& result) const;
1743
1744 /**
1745 * Computes the union of its operands which must be node-sets.
1746 *
1747 * @param context The current source tree context node.
1748 * @param opPos The current position in the Op Map.
1749 * @param executionContext current execution context
1750 * @result the result of the union of node-set operands.
1751 */
1752 void
1754 XalanNode* context,
1756 XPathExecutionContext& executionContext,
1757 double& result) const;
1758
1759 /**
1760 * Computes the union of its operands which must be node-sets.
1761 *
1762 * @param context The current source tree context node.
1763 * @param opPos The current position in the Op Map.
1764 * @param executionContext current execution context
1765 * @result the result of the union of node-set operands.
1766 */
1767 void
1769 XalanNode* context,
1771 XPathExecutionContext& executionContext,
1772 XalanDOMString& result) const;
1773
1774 /**
1775 * Computes the union of its operands which must be node-sets.
1776 *
1777 * @param context The current source tree context node.
1778 * @param opPos The current position in the Op Map.
1779 * @param executionContext current execution context
1780 * @param formatterListener the FormatterListener instance to receive the result
1781 * @param function A pointer to the member function of FormatterListener to call
1782 */
1783 void
1785 XalanNode* context,
1787 XPathExecutionContext& executionContext,
1788 FormatterListener& formatterListener,
1789 MemberFunctionPtr function) const;
1790
1791 /**
1792 * Computes the union of its operands which must be node-sets.
1793 * @param context The current source tree context node.
1794 * @param opPos The current position in the Op Map.
1795 * @param executionContext current execution context
1796 * @result the result of the union of node-set operands.
1797 */
1798 void
1800 XalanNode* context,
1802 XPathExecutionContext& executionContext,
1803 MutableNodeRefList& result) const;
1804
1805 /**
1806 * Get a literal value.
1807 * @param opPos The current position in the Op Map.
1808 * @param executionContext current execution context
1809 * @return an XObject object.
1810 */
1811 const XObjectPtr
1814 XPathExecutionContext& executionContext) const;
1815
1816 /**
1817 * Get a literal value as a boolean.
1818 *
1819 * @param opPos The current position in the Op Map.
1820 * @param theResult The value.
1821 */
1822 void
1825 bool& theResult) const;
1826
1827 /**
1828 * Get a literal value as a number.
1829 *
1830 * @param opPos The current position in the Op Map.
1831 * @param theResult The value.
1832 */
1833 void
1836 double& theResult) const;
1837
1838 /**
1839 * Get a literal value. The value is appended to the
1840 * supplied string.
1841 *
1842 * @param opPos The current position in the Op Map.
1843 * @param theResult The string.
1844 */
1845 void
1848 XalanDOMString& theResult) const;
1849
1850 /**
1851 * Get a literal value.
1852 * @param opPos The current position in the Op Map.
1853 * @param executionContext current execution context
1854 * @return The result as a double.
1855 */
1856 void
1859 FormatterListener& formatterListener,
1860 MemberFunctionPtr function) const;
1861
1862 /**
1863 * Get the value of a variable.
1864 * @param opPos The current position in the Op Map.
1865 * @param executionContext current execution context
1866 * @return an XObject object.
1867 */
1868 const XObjectPtr
1871 XPathExecutionContext& executionContext) const;
1872
1873 /**
1874 * Execute an expression as a group.
1875 * @param context The current source tree context node.
1876 * @param opPos The current position in the Op Map.
1877 * @param executionContext current execution context
1878 * @return arg.
1879 */
1880 const XObjectPtr
1882 XalanNode* context,
1884 XPathExecutionContext& executionContext) const
1885 {
1886 return executeMore(context, opPos + 2, executionContext);
1887 }
1888
1889 /**
1890 * Execute an expression as a group.
1891 * @param context The current source tree context node.
1892 * @param opPos The current position in the Op Map.
1893 * @param executionContext current execution context
1894 * @param theResult The result of the execution
1895 */
1896 void
1898 XalanNode* context,
1900 XPathExecutionContext& executionContext,
1901 bool& theResult) const
1902 {
1903 executeMore(context, opPos + 2, executionContext, theResult);
1904 }
1905
1906 /**
1907 * Execute an expression as a group.
1908 * @param context The current source tree context node.
1909 * @param opPos The current position in the Op Map.
1910 * @param executionContext current execution context
1911 * @param theResult The result of the execution
1912 */
1913 void
1915 XalanNode* context,
1917 XPathExecutionContext& executionContext,
1918 double& theResult) const
1919 {
1920 executeMore(context, opPos + 2, executionContext, theResult);
1921 }
1922
1923 /**
1924 * Execute an expression as a group.
1925 * @param context The current source tree context node.
1926 * @param opPos The current position in the Op Map.
1927 * @param executionContext current execution context
1928 * @param theResult The result of the execution
1929 */
1930 void
1932 XalanNode* context,
1934 XPathExecutionContext& executionContext,
1935 XalanDOMString& theResult) const
1936 {
1937 executeMore(context, opPos + 2, executionContext, theResult);
1938 }
1939
1940 /**
1941 * Execute an expression as a group.
1942 *
1943 * @param context The current source tree context node.
1944 * @param opPos The current position in the Op Map.
1945 * @param executionContext current execution context
1946 * @param formatterListener the FormatterListener instance to receive the result
1947 * @param function A pointer to the member function of FormatterListener to call
1948 */
1949 void
1951 XalanNode* context,
1953 XPathExecutionContext& executionContext,
1954 FormatterListener& formatterListener,
1955 MemberFunctionPtr function) const
1956 {
1957 executeMore(
1958 context,
1959 opPos + 2,
1960 executionContext,
1961 formatterListener,
1962 function);
1963 }
1964
1965 /**
1966 * Execute an expression as a group.
1967 * @param context The current source tree context node.
1968 * @param opPos The current position in the Op Map.
1969 * @param executionContext current execution context
1970 * @param theResult The result of the execution
1971 */
1972 void
1974 XalanNode* context,
1976 XPathExecutionContext& executionContext,
1977 MutableNodeRefList& theResult) const
1978 {
1979 const XObjectPtr theValue(executeMore(
1980 context,
1981 opPos + 2,
1982 executionContext,
1983 theResult));
1984
1985 if (theValue.null() == false)
1986 {
1987 theResult.addNodesInDocOrder(
1988 theValue->nodeset(),
1989 executionContext);
1990
1991 theResult.setDocumentOrder();
1992 }
1993 }
1994
1995 /**
1996 * Get a literal value.
1997 * @param opPos The current position in the Op Map.
1998 * @return The result as a double.
1999 */
2000 double
2002
2003 /**
2004 * Get a literal value.
2005 * @param opPos The current position in the Op Map.
2006 * @return The result as a double.
2007 */
2008 const XObjectPtr
2011 XPathExecutionContext& executionContext) const;
2012
2013 /**
2014 * Get a literal value as a boolean.
2015 *
2016 * @param opPos The current position in the Op Map.
2017 * @param theResult The string.
2018 */
2019 void
2022 bool& theResult) const;
2023
2024 /**
2025 * Get a literal value. The value is appended to the
2026 * supplied string.
2027 *
2028 * @param opPos The current position in the Op Map.
2029 * @param theResult The string.
2030 */
2031 void
2034 XalanDOMString& theResult) const;
2035
2036 /**
2037 * Get a literal value.
2038 *
2039 * @param opPos The current position in the Op Map.
2040 * @param formatterListener the FormatterListener instance to receive the result
2041 * @param function A pointer to the member function of FormatterListener to call
2042 */
2043 void
2046 FormatterListener& formatterListener,
2047 MemberFunctionPtr function) const;
2048
2049 /**
2050 * Setup for and run an extension function.
2051 * @param context The current source tree context node.
2052 * @param opPos The current position in the Op Map.
2053 * @param executionContext current execution context
2054 * @return the result of the function.
2055 */
2056 const XObjectPtr
2058 XalanNode* context,
2060 XPathExecutionContext& executionContext) const;
2061
2062 /**
2063 * Handle an extension function.
2064 * @param context The current source tree context node.
2065 * @param opPos The current position in the Op Map.
2066 * @param theNamespace The namespace of the function.
2067 * @param functionName The name of the function.
2068 * @param executionContext current execution context
2069 * @return the result of the function.
2070 */
2071 const XObjectPtr
2073 XalanNode* context,
2074 OpCodeMapPositionType /* opPos */,
2075 const XalanDOMString& theNamespace,
2076 const XalanDOMString& functionName,
2077 const Function::XObjectArgVectorType& argVec,
2078 XPathExecutionContext& executionContext) const
2079 {
2080 return executionContext.extFunction(theNamespace,
2081 functionName,
2082 context,
2083 argVec,
2084 m_locator);
2085 }
2086
2087 /**
2088 * Setup for and run a function.
2089 * @param context The current source tree context node.
2090 * @param opPos The current position in the Op Map.
2091 * @param executionContext current execution context
2092 * @return the result of the function.
2093 */
2094 const XObjectPtr
2096 XalanNode* context,
2098 XPathExecutionContext& executionContext) const;
2099
2100 /**
2101 * Handle a built-in function.
2102 * @param context The current source tree context node.
2103 * @param funcID The function ID.
2104 * @param argVec The arguments for the function.
2105 * @param executionContext current execution context
2106 * @return the result of the function.
2107 */
2108 const XObjectPtr
2110 XalanNode* context,
2111 OpCodeMapValueType funcID,
2112 const Function::XObjectArgVectorType& argVec,
2113 XPathExecutionContext& executionContext) const
2114 {
2115 return s_functions[funcID].execute(executionContext, context, argVec, m_locator);
2116 }
2117
2118 /**
2119 * Handle the built-in function "position".
2120 *
2121 * @param context The current source tree context node, which must not be 0.
2122 * @param executionContext current execution context
2123 * @return the result of the function.
2124 */
2125 double
2127 XalanNode* context,
2128 XPathExecutionContext& executionContext) const
2129 {
2130 assert(context != 0);
2131
2132 const XPathExecutionContext::size_type theResult =
2133 executionContext.getContextNodeListPosition(*context);
2134 assert(static_cast<double>(theResult) == theResult);
2135
2136 return static_cast<double>(theResult);
2137 }
2138
2139 /**
2140 * Handle the built-in function "last".
2141 *
2142 * @param executionContext current execution context
2143 * @return the result of the function.
2144 */
2145 double
2146 functionLast(XPathExecutionContext& executionContext) const
2147 {
2148 const XPathExecutionContext::size_type theResult =
2149 executionContext.getContextNodeListLength();
2150 assert(static_cast<double>(theResult) == theResult);
2151
2152 return static_cast<double>(theResult);
2153 }
2154
2155 /**
2156 * Handle the built-in function "count".
2157 *
2158 * @param context The current source tree context node.
2159 * @param opPos The current position in the Op Map.
2160 * @param executionContext current execution context
2161 * @return the result of the function.
2162 */
2163 double
2165 XalanNode* context,
2167 XPathExecutionContext& executionContext) const;
2168
2169 /**
2170 * Handle the built-in function "not".
2171 *
2172 * @param context The current source tree context node, which must not be 0.
2173 * @param opPos The current position in the Op Map.
2174 * @param executionContext current execution context
2175 * @return the result of the function.
2176 */
2177 bool
2179 XalanNode* context,
2181 XPathExecutionContext& executionContext) const
2182 {
2183 assert(context != 0);
2184
2185 return !functionBoolean(context, opPos, executionContext);
2186 }
2187
2188 /**
2189 * Handle the built-in function "boolean".
2190 *
2191 * @param context The current source tree context node, which must not be 0.
2192 * @param opPos The current position in the Op Map.
2193 * @param executionContext current execution context
2194 * @return the result of the function.
2195 */
2196 bool
2198 XalanNode* context,
2200 XPathExecutionContext& executionContext) const
2201 {
2202 assert(context != 0);
2203
2204 bool result;
2205
2206 executeMore(context, opPos + 2, executionContext, result);
2207
2208 return result;
2209 }
2210
2211 /**
2212 * Handle the built-in function "name".
2213 *
2214 * @param context The current source tree context node, which must not be 0.
2215 * @return the result of the function.
2216 */
2217 const XalanDOMString&
2218 functionName(XalanNode* context) const
2219 {
2220 assert(context != 0);
2221
2222 return DOMServices::getNameOfNode(*context);
2223 }
2224
2225 /**
2226 * Handle the built-in function "name".
2227 *
2228 * @param context The current source tree context node, which must not be 0.
2229 * @param opPos The current position in the Op Map.
2230 * @param executionContext current execution context
2231 * @return the result of the function.
2232 */
2233 const XalanDOMString&
2235 XalanNode* context,
2237 XPathExecutionContext& executionContext) const;
2238
2239 /**
2240 * Handle the built-in function "local-name".
2241 *
2242 * @param context The current source tree context node, which must not be 0.
2243 * @return the result of the function.
2244 */
2245 const XalanDOMString&
2247
2248 /**
2249 * Handle the built-in function "local-name".
2250 *
2251 * @param context The current source tree context node, which must not be 0.
2252 * @param opPos The current position in the Op Map.
2253 * @param executionContext current execution context
2254 * @return the result of the function.
2255 */
2256 const XalanDOMString&
2258 XalanNode* context,
2260 XPathExecutionContext& executionContext) const;
2261
2262 /**
2263 * Handle the built-in function "number".
2264 *
2265 * @param context The current source tree context node, which must not be 0.
2266 * @param executionContext current execution context
2267 * @return the result of the function.
2268 */
2269 double
2271 XalanNode* context,
2272 XPathExecutionContext& executionContext) const
2273 {
2274 assert(context != 0);
2275
2276 return XObject::number(executionContext, *context);
2277 }
2278
2279 /**
2280 * Handle the built-in function "number".
2281 *
2282 * @param context The current source tree context node, which must not be 0.
2283 * @param opPos The current position in the Op Map.
2284 * @param executionContext current execution context
2285 * @return the result of the function.
2286 */
2287 double
2289 XalanNode* context,
2291 XPathExecutionContext& executionContext) const
2292 {
2293 double result;
2294
2295 executeMore(context, opPos + 2, executionContext, result);
2296
2297 return result;
2298 }
2299
2300 /**
2301 * Handle the built-in function "floor".
2302 *
2303 * @param context The current source tree context node, which must not be 0.
2304 * @param opPos The current position in the Op Map.
2305 * @param executionContext current execution context
2306 * @return the result of the function.
2307 */
2308 double
2310 XalanNode* context,
2312 XPathExecutionContext& executionContext) const
2313 {
2314 return DoubleSupport::floor(functionNumber(context, opPos, executionContext));
2315 }
2316
2317 /**
2318 * Handle the built-in function "ceiling".
2319 *
2320 * @param context The current source tree context node, which must not be 0.
2321 * @param opPos The current position in the Op Map.
2322 * @param executionContext current execution context
2323 * @return the result of the function.
2324 */
2325 double
2327 XalanNode* context,
2329 XPathExecutionContext& executionContext) const
2330 {
2331 return DoubleSupport::ceiling(functionNumber(context, opPos, executionContext));
2332 }
2333
2334 /**
2335 * Handle the built-in function "round".
2336 *
2337 * @param context The current source tree context node, which must not be 0.
2338 * @param opPos The current position in the Op Map.
2339 * @param executionContext current execution context
2340 * @return the result of the function.
2341 */
2342 double
2344 XalanNode* context,
2346 XPathExecutionContext& executionContext) const
2347 {
2348 return DoubleSupport::round(functionNumber(context, opPos, executionContext));
2349 }
2350
2351 /**
2352 * Handle the built-in function "string-length".
2353 *
2354 * @param context The current source tree context node, which must not be 0.
2355 * @param executionContext current execution context
2356 * @return the result of the function.
2357 */
2358 double
2360 XalanNode* context,
2361 XPathExecutionContext& executionContext) const;
2362
2363 /**
2364 * Handle the built-in function "string-length".
2365 *
2366 * @param context The current source tree context node, which must not be 0.
2367 * @param opPos The current position in the Op Map.
2368 * @param executionContext current execution context
2369 * @return the result of the function.
2370 */
2371 double
2373 XalanNode* context,
2375 XPathExecutionContext& executionContext) const;
2376
2377 /**
2378 * Handle the built-in function "sum".
2379 *
2380 * @param context The current source tree context node.
2381 * @param opPos The current position in the Op Map.
2382 * @param executionContext current execution context
2383 * @return the result of the function.
2384 */
2385 double
2387 XalanNode* context,
2389 XPathExecutionContext& executionContext) const;
2390
2391 /**
2392 * Get a numeric operand for an expression.
2393 * @param context The current source tree context node.
2394 * @param opPos The current position in the Op Map.
2395 * @param executionContext current execution context
2396 * @return The value of the operand.
2397 */
2398 double
2400 XalanNode* context,
2402 XPathExecutionContext& executionContext) const;
2403
2404private:
2405
2406 // These are not implemented...
2407 XPath(const XPath&);
2408
2409 XPath&
2410 operator=(const XPath&);
2411
2412 bool
2413 operator==(const XPath&) const;
2414
2415 // Default vector allocation sizes.
2416 enum
2417 {
2418 eDefaultTargetDataSize = 5
2419 };
2420
2421 OpCodeMapPositionType
2422 getInitialOpCodePosition() const
2423 {
2424#if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
2425 assert(m_expression.getOpCodeMapValue(0) == XPathExpression::eOP_XPATH);
2426#else
2427 assert(m_expression.getOpCodeMapValue(
2428 m_expression.getInitialOpCodePosition()) == XPathExpression::eOP_XPATH);
2429#endif
2430 return m_expression.getInitialOpCodePosition() + 2;
2431 }
2432
2433 eMatchScore
2434 locationPathPattern(
2435 XPathExecutionContext& executionContext,
2436 XalanNode& context,
2437 OpCodeMapPositionType opPos) const;
2438
2439protected:
2440
2441 /**
2442 * Execute a step in a location path.
2443 *
2444 * @param xpath The xpath that is executing
2445 * @param context The current source tree context node
2446 * @param opPos The current position in the xpath operation map array
2447 * @param queryResults The set of nodes that matches the step.
2448 */
2449 void
2451 XPathExecutionContext& executionContext,
2452 XalanNode* context,
2454 MutableNodeRefList& queryResults) const;
2455
2456 /**
2457 * Potentially evaluate a predicate in a match pattern step.
2458 *
2459 * @param executionContext The current execution context.
2460 * @param context The current source tree context node.
2461 * @param opPos The current position in the Op Map.
2462 * @param startOpPos The original position for the step in the Op Map.
2463 * @param score The current match score for the context node.
2464 * @return The resulting match score
2465 */
2468 XPathExecutionContext& executionContext,
2469 XalanNode* context,
2471 OpCodeMapPositionType startOpPos,
2472 eMatchScore score) const;
2473
2474 /**
2475 * Execute a step in a match pattern's location path.
2476 *
2477 * @param xpath The xpath that is executing
2478 * @param context The current source tree context node
2479 * @param opPos The current position in the xpath operation map array
2480 * @param scoreHolder a reference to an eMatchScore to receive
2481 * the result.
2482 * @return the last matched context node
2483 */
2484 XalanNode*
2486 XPathExecutionContext& executionContext,
2487 XalanNode* context,
2489 eMatchScore& scoreHolder) const;
2490
2493 XPathExecutionContext& executionContext,
2494 XalanNode* context,
2496 OpCodeMapValueType stepType,
2497 MutableNodeRefList& subQueryResults) const;
2498
2501 XPathExecutionContext& executionContext,
2502 XalanNode* context,
2504 OpCodeMapValueType stepType,
2505 MutableNodeRefList& subQueryResults) const;
2506
2509 XPathExecutionContext& executionContext,
2510 XalanNode* context,
2512 OpCodeMapValueType stepType,
2513 MutableNodeRefList& subQueryResults) const;
2514
2517 XPathExecutionContext& executionContext,
2518 XalanNode* context,
2520 OpCodeMapValueType stepType,
2521 MutableNodeRefList& subQueryResults) const;
2522
2525 XPathExecutionContext& executionContext,
2526 XalanNode* context,
2528 OpCodeMapValueType stepType,
2529 MutableNodeRefList& subQueryResults) const;
2530
2533 XPathExecutionContext& executionContext,
2534 XalanNode* context,
2536 OpCodeMapValueType stepType,
2537 MutableNodeRefList& subQueryResults) const;
2538
2541 XPathExecutionContext& executionContext,
2542 XalanNode* context,
2544 OpCodeMapValueType stepType,
2545 MutableNodeRefList& subQueryResults) const;
2546
2549 XPathExecutionContext& executionContext,
2550 XalanNode* context,
2552 OpCodeMapValueType stepType,
2553 MutableNodeRefList& subQueryResults) const;
2554
2557 XPathExecutionContext& executionContext,
2558 XalanNode* context,
2560 OpCodeMapValueType stepType,
2561 MutableNodeRefList& subQueryResults) const;
2562
2565 XPathExecutionContext& executionContext,
2566 XalanNode* context,
2568 OpCodeMapValueType stepType,
2569 MutableNodeRefList& subQueryResults) const;
2570
2573 XPathExecutionContext& executionContext,
2574 XalanNode* context,
2576 OpCodeMapValueType stepType,
2577 MutableNodeRefList& subQueryResults) const;
2578
2581 XPathExecutionContext& executionContext,
2582 XalanNode* context,
2584 OpCodeMapValueType stepType,
2585 MutableNodeRefList& subQueryResults) const;
2586
2589 XPathExecutionContext& executionContext,
2590 XalanNode* context,
2592 OpCodeMapValueType stepType,
2593 MutableNodeRefList& subQueryResults) const;
2594
2597 XPathExecutionContext& executionContext,
2598 XalanNode* context,
2600 OpCodeMapValueType stepType,
2601 MutableNodeRefList& subQueryResults) const;
2602
2605 XPathExecutionContext& executionContext,
2606 XalanNode* context,
2608 OpCodeMapValueType stepType,
2609 MutableNodeRefList& subQueryResults) const;
2610
2613 XPathExecutionContext& executionContext,
2615 MutableNodeRefList& subQueryResults) const;
2616
2619 XPathExecutionContext& executionContext,
2620 XalanNode* localContext,
2621 OpCodeMapPositionType startOpPos) const;
2622
2625 XPathExecutionContext& executionContext,
2626 XalanNode* localContext,
2627 OpCodeMapPositionType startOpPos) const;
2628
2629private:
2630
2631 void
2632 unknownOpCodeError(
2633 XalanNode* context,
2634 XPathExecutionContext& executionContext,
2635 OpCodeMapPositionType opPos) const;
2636
2637 void
2638 notNodeSetError(
2639 XalanNode* context,
2640 XPathExecutionContext& executionContext) const;
2641
2642 // Data members...
2643
2644 /**
2645 *
2646 * Holds information about the current expression.
2647 *
2648 */
2649 XPathExpression m_expression;
2650
2651 /**
2652 * A Locator for reporting errors.
2653 */
2654 const Locator* m_locator;
2655
2656 /**
2657 * If true, the XPath can allocated XObjects in more
2658 * efficient ways, since its lifetime is guaranteed
2659 * to be at least that of the transformation.
2660 */
2661 bool m_inStylesheet;
2662
2663 /**
2664 *
2665 * This is the table of installed functions.
2666 *
2667 */
2668 static FunctionTableType s_functions;
2669
2670 static const XalanDOMString s_emptyString;
2671};
2672
2673
2674
2675}
2676
2677
2678
2679#endif // XPATH_HEADER_GUARD_1357924680
#define XALAN_XPATH_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
A SAX-based formatter interface for the XSL processor.
Local implementation of MutableNodeRefList.
void setDocumentOrder()
Set the known order of the nodes.
void addNodesInDocOrder(const XalanNodeList &nodelist, XPathExecutionContext &executionContext)
Copy NodeList members into this nodelist, adding in document order.
Local implementation of NodeRefList.
This class defines an interface for classes that resolve namespace prefixes to their URIs.
Class to hold XObjectPtr return types.
Definition: XObject.hpp:884
bool null() const
Definition: XObject.hpp:937
virtual const NodeRefListBase & nodeset() const
Cast result object to a nodelist.
NodeRefListBase::size_type size_type
virtual XalanNode * getCurrentNode() const =0
Retrieve the node currently being executed.
virtual size_type getContextNodeListPosition(const XalanNode &contextNode) const =0
virtual const XObjectPtr extFunction(const XalanDOMString &theNamespace, const XalanDOMString &functionName, XalanNode *context, const XObjectArgVectorType &argVec, const Locator *locator)=0
Handle an extension function.
virtual const PrefixResolver * getPrefixResolver() const =0
Retrieve the resolver for namespaces.
virtual size_type getContextNodeListLength() const =0
OpCodeMapType::const_iterator OpCodeMapPositionType
OpCodeMapType::value_type OpCodeMapValueType
TokenQueueSizeType TokenQueuePositionType
Class defines a table of functions that can be called in XPath expresions.
eMatchScore initialize(XPathConstructionContext &theConstructionContext, const XalanDOMString &theNameTest, const PrefixResolver &thePrefixResolver, const Locator *theLocator)
NodeTester(XPathConstructionContext &theContext, const XalanDOMString &theNameTest, const PrefixResolver &thePrefixResolver, const Locator *theLocator=0, eMatchScore *theMatchScore=0)
NodeTester(const NodeTester &theSource)
NodeTester(const XalanDOMString &theNamespaceURI, const XalanDOMString &theLocalName, eMatchScore *theMatchScore=0)
NodeTester & operator=(const NodeTester &theRHS)
Definition: XPath.hpp:1076
NodeTester(const XPath &xpath, XPathExecutionContext &executionContext, OpCodeMapPositionType opPos, OpCodeMapValueType argLen, OpCodeMapValueType stepType)
eMatchScore initialize(const XalanDOMString &theNamespaceURI, const XalanDOMString &theLocalName)
eMatchScore operator()(const XalanNode &context, XalanNode::NodeType nodeType) const
Definition: XPath.hpp:1060
eMatchScore operator()(const XalanElement &context) const
Definition: XPath.hpp:1070
const XalanDOMChar * getString() const
Definition: XPath.hpp:122
eMatchScore getDefaultPriority() const
Definition: XPath.hpp:128
eTargetType getTargetType() const
Definition: XPath.hpp:134
TargetData(const XalanDOMChar *theString, eMatchScore thePriority, eTargetType theTargetType)
Definition: XPath.hpp:111
void neg(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Return the negation of a number.
static bool uninstallFunction(const XalanDOMChar *funcName)
Remove a named function from the function table.
Definition: XPath.hpp:960
const XObjectPtr locationPath(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Execute a location path.
void execute(const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute the XPath from the provided context.
Definition: XPath.hpp:746
XPathExecutionContext::GetCachedString GetCachedString
Definition: XPath.hpp:76
bool gt(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Tell if one argument is greater than the other argument.
void numberlit(OpCodeMapPositionType opPos, bool &theResult) const
Get a literal value as a boolean.
const XalanDOMString & functionName(XalanNode *context) const
Handle the built-in function "name".
Definition: XPath.hpp:2218
void executeMore(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, double &theResult) const
Execute the XPath from the provided context.
double mod(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Return the remainder from a truncating division.
double functionCount(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "count".
void execute(XalanNode *context, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, XalanDOMString &result) const
Execute the XPath from the provided context.
bool lte(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Tell if one argument is less than or equal to the other argument.
MemoryManager & getMemoryManager()
Definition: XPath.hpp:178
XPathFunctionTable FunctionTableType
Definition: XPath.hpp:977
void group(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, MutableNodeRefList &theResult) const
Execute an expression as a group.
Definition: XPath.hpp:1973
const XObjectPtr executeMore(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, MutableNodeRefList &theResult) const
Execute the XPath from the provided context.
bool And(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
OR two expressions and return the boolean result.
const XObjectPtr execute(XalanNode *context, const PrefixResolver &prefixResolver, const NodeRefListBase &contextNodeList, XPathExecutionContext &executionContext) const
Execute the XPath from the provided context.
Definition: XPath.hpp:309
void execute(XalanNode *context, const PrefixResolver &prefixResolver, const NodeRefListBase &contextNodeList, XPathExecutionContext &executionContext, bool &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:333
bool lt(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Tell if one argument is less than the other argument.
void numberlit(OpCodeMapPositionType opPos, FormatterListener &formatterListener, MemberFunctionPtr function) const
Get a literal value.
double minus(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Give the difference of two arguments.
double functionFloor(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "floor".
Definition: XPath.hpp:2309
static void installFunction(const XalanDOMChar *funcName, const Function &func)
Install a built-in function.
Definition: XPath.hpp:933
const XObjectPtr execute(XalanNode *context, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext) const
Execute the XPath from the provided context.
OpCodeMapPositionType findSelf(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
static double getMatchScoreValue(eMatchScore score)
Definition: XPath.hpp:831
static XPath * create(MemoryManager &theManager, const Locator *theLocator=0)
void executeMore(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, XalanDOMString &theResult) const
Execute the XPath from the provided context.
void execute(XalanNode *context, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, double &result) const
Execute the XPath from the provided context.
double functionStringLength(XalanNode *context, XPathExecutionContext &executionContext) const
Handle the built-in function "string-length".
static void destroyTable()
Definition: XPath.hpp:1003
OpCodeMapPositionType findNamespace(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
static void installFunction(const XalanDOMString &funcName, const Function &func)
Install a built-in function.
Definition: XPath.hpp:918
void execute(XPathExecutionContext &executionContext, XalanDOMString &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:542
void locationPath(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, XalanDOMString &theResult) const
Execute a location path.
double mult(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Multiply two arguments.
eMatchScore handleFoundIndex(XPathExecutionContext &executionContext, XalanNode *localContext, OpCodeMapPositionType startOpPos) const
const XObjectPtr execute(XPathExecutionContext &executionContext, MutableNodeRefList &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:604
double div(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Divide a number.
bool gte(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Tell if one argument is greater than or equal to the other argument.
void Union(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Computes the union of its operands which must be node-sets.
void execute(XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute the XPath from the provided context.
Definition: XPath.hpp:567
void literal(OpCodeMapPositionType opPos, FormatterListener &formatterListener, MemberFunctionPtr function) const
Get a literal value.
XalanNode * stepPattern(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, eMatchScore &scoreHolder) const
Execute a step in a match pattern's location path.
void mod(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Return the remainder from a truncating division.
OpCodeMapPositionType findChildren(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
void step(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, MutableNodeRefList &queryResults) const
Execute a step in a location path.
void div(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Divide a number.
OpCodeMapPositionType findFollowing(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
double numberlit(OpCodeMapPositionType opPos) const
Get a literal value.
XPathExpression::OpCodeMapValueType OpCodeMapValueType
Definition: XPath.hpp:74
void Union(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, double &result) const
Computes the union of its operands which must be node-sets.
double functionLast(XPathExecutionContext &executionContext) const
Handle the built-in function "last".
Definition: XPath.hpp:2146
bool Or(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
OR two expressions and return the boolean result.
bool getInStylesheet() const
Definition: XPath.hpp:1009
eMatchScore getMatchScore(XalanNode *node, const PrefixResolver &resolver, XPathExecutionContext &executionContext) const
Get the match score for the specified node.
void getTargetData(TargetDataVectorType &targetData) const
Add the data for the target of match pattern to a vector.
bool functionBoolean(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "boolean".
Definition: XPath.hpp:2197
double functionNumber(XalanNode *context, XPathExecutionContext &executionContext) const
Handle the built-in function "number".
Definition: XPath.hpp:2270
XPathExpression & getExpression()
Retrieve a reference to the current expression.
Definition: XPath.hpp:814
OpCodeMapPositionType findDescendants(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
void execute(const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, XalanDOMString &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:718
const XObjectPtr execute(const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext) const
Execute the XPath from the provided context.
Definition: XPath.hpp:629
XPathExpression::OpCodeMapPositionType OpCodeMapPositionType
Definition: XPath.hpp:73
double functionNumber(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "number".
Definition: XPath.hpp:2288
OpCodeMapPositionType findRoot(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
void shrink()
Shrink internal tables.
Definition: XPath.hpp:189
static void terminate()
Perform static shut down.
void execute(const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, bool &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:657
bool equals(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Tell if two expressions are functionally equal.
const XalanDOMString & functionName(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "name".
void executeMore(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute the XPath from the provided context.
double functionStringLength(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "string-length".
void execute(XalanNode *context, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute the XPath from the provided context.
const XObjectPtr execute(XPathExecutionContext &executionContext) const
Execute the XPath from the provided context.
Definition: XPath.hpp:472
static bool isInstalledFunction(const XalanDOMString &theFunctionName)
Whether the named function is installed in the function table.
Definition: XPath.hpp:972
void execute(XPathExecutionContext &executionContext, double &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:517
const XObjectPtr execute(XalanNode *context, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, MutableNodeRefList &result) const
Execute the XPath from the provided context.
OpCodeMapPositionType findPreceedingSiblings(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
xercesc::Locator LocatorType
Definition: XPath.hpp:71
void execute(XalanNode *context, const PrefixResolver &prefixResolver, const NodeRefListBase &contextNodeList, XPathExecutionContext &executionContext, double &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:358
eMatchScore getMatchScore(XalanNode *node, XPathExecutionContext &executionContext) const
Get the match score for the specified node.
eMatchScore doStepPredicate(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapPositionType startOpPos, eMatchScore score) const
Potentially evaluate a predicate in a match pattern step.
const XObjectPtr predicate(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Evaluate a predicate.
Definition: XPath.hpp:895
void execute(const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, double &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:687
double plus(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Give the sum of two arguments.
static bool uninstallFunction(const XalanDOMString &funcName)
Remove a named function from the function table.
Definition: XPath.hpp:948
const XObjectPtr Union(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Computes the union of its operands which must be node-sets.
XPathExpression::TokenQueuePositionType TokenQueuePositionType
Definition: XPath.hpp:75
void execute(XalanNode *context, const PrefixResolver &prefixResolver, const NodeRefListBase &contextNodeList, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute the XPath from the provided context.
Definition: XPath.hpp:410
OpCodeMapPositionType findNodeSet(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
const XObjectPtr extfunction(XalanNode *context, OpCodeMapPositionType, const XalanDOMString &theNamespace, const XalanDOMString &functionName, const Function::XObjectArgVectorType &argVec, XPathExecutionContext &executionContext) const
Handle an extension function.
Definition: XPath.hpp:2072
OpCodeMapPositionType findPreceeding(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
const XObjectPtr literal(OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Get a literal value.
void locationPath(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute a location path.
void Union(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, MutableNodeRefList &result) const
Computes the union of its operands which must be node-sets.
void literal(OpCodeMapPositionType opPos, bool &theResult) const
Get a literal value as a boolean.
XObjectPtr execute(const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, MutableNodeRefList &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:789
const Locator * getLocator() const
Definition: XPath.hpp:1021
static void getInstalledFunctionNames(OutputIteratorType theIterator)
Add the names for the installed functions to a vector strings.
Definition: XPath.hpp:997
double getNumericOperand(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Get a numeric operand for an expression.
void mult(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Multiply two arguments.
void Union(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, bool &result) const
Computes the union of its operands which must be node-sets.
XPathExecutionContext::PrefixResolverSetAndRestore PrefixResolverSetAndRestore
Definition: XPath.hpp:77
void group(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, XalanDOMString &theResult) const
Execute an expression as a group.
Definition: XPath.hpp:1931
void locationPath(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, double &theResult) const
Execute a location path.
const XObjectPtr numberlit(OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Get a literal value.
void numberlit(OpCodeMapPositionType opPos, XalanDOMString &theResult) const
Get a literal value.
OpCodeMapPositionType findParent(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
double functionPosition(XalanNode *context, XPathExecutionContext &executionContext) const
Handle the built-in function "position".
Definition: XPath.hpp:2126
void executeMore(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, bool &theResult) const
Execute the XPath from the provided context.
void Union(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, XalanDOMString &result) const
Computes the union of its operands which must be node-sets.
const XalanDOMString & functionLocalName(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "local-name".
OpCodeMapPositionType findFollowingSiblings(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
const XPathExpression & getExpression() const
Retrieve a reference to the current expression.
Definition: XPath.hpp:825
void setInStylesheet(bool fValue)
Definition: XPath.hpp:1015
bool functionNot(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "not".
Definition: XPath.hpp:2178
void locationPath(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, bool &theResult) const
Execute a location path.
OpCodeMapPositionType findNodesOnUnknownAxis(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
void minus(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Give the difference of two arguments.
void literal(OpCodeMapPositionType opPos, double &theResult) const
Get a literal value as a number.
bool notequals(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Tell if two expressions are functionally not equal.
void execute(XPathExecutionContext &executionContext, bool &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:493
OpCodeMapPositionType findAttributes(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
double functionRound(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "round".
Definition: XPath.hpp:2343
const XObjectPtr execute(XalanNode *context, const PrefixResolver &prefixResolver, const NodeRefListBase &contextNodeList, XPathExecutionContext &executionContext, MutableNodeRefList &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:447
void plus(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Give the sum of two arguments.
double neg(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Return the negation of a number.
@ eMatchScoreQName
Definition: XPath.hpp:94
@ eMatchScoreNodeTest
Definition: XPath.hpp:92
@ eMatchScoreNone
Definition: XPath.hpp:91
@ eMatchScoreNSWild
Definition: XPath.hpp:93
static const FunctionTableType & getFunctionTable()
Retrieve the table of installed functions.
Definition: XPath.hpp:985
void setLocator(const Locator *theLocator)
Definition: XPath.hpp:1027
void doGetMatchScore(XalanNode *context, XPathExecutionContext &executionContext, eMatchScore &score) const
Helper function to get match score.
void locationPath(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, MutableNodeRefList &theResult) const
Execute a location path.
Definition: XPath.hpp:1324
const XObjectPtr function(XalanNode *context, OpCodeMapValueType funcID, const Function::XObjectArgVectorType &argVec, XPathExecutionContext &executionContext) const
Handle a built-in function.
Definition: XPath.hpp:2109
void group(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, FormatterListener &formatterListener, MemberFunctionPtr function) const
Execute an expression as a group.
Definition: XPath.hpp:1950
OpCodeMapPositionType findAncestorsOrSelf(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
XPathExecutionContext::CurrentNodePushAndPop CurrentNodePushAndPop
Definition: XPath.hpp:78
double functionSum(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "sum".
const XObjectPtr executeMore(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Execute the XPath from the provided context.
static void initialize(MemoryManager &theManager)
Perform static initialization.
eMatchScore handleFoundIndexPositional(XPathExecutionContext &executionContext, XalanNode *localContext, OpCodeMapPositionType startOpPos) const
const XObjectPtr variable(OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Get the value of a variable.
const XObjectPtr runExtFunction(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Setup for and run an extension function.
XPath(MemoryManager &theManager, const Locator *theLocator=0)
Construct an XPath.
void group(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, double &theResult) const
Execute an expression as a group.
Definition: XPath.hpp:1914
double functionCeiling(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Handle the built-in function "ceiling".
Definition: XPath.hpp:2326
void execute(XalanNode *context, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext, bool &result) const
Execute the XPath from the provided context.
const XObjectPtr runFunction(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Setup for and run a function.
void literal(OpCodeMapPositionType opPos, XalanDOMString &theResult) const
Get a literal value.
const XObjectPtr group(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext) const
Execute an expression as a group.
Definition: XPath.hpp:1881
void execute(XalanNode *context, const PrefixResolver &prefixResolver, const NodeRefListBase &contextNodeList, XPathExecutionContext &executionContext, XalanDOMString &result) const
Execute the XPath from the provided context.
Definition: XPath.hpp:384
const XalanDOMString & functionLocalName(XalanNode *context) const
Handle the built-in function "local-name".
OpCodeMapPositionType predicates(XPathExecutionContext &executionContext, OpCodeMapPositionType opPos, MutableNodeRefList &subQueryResults) const
OpCodeMapPositionType findAncestors(XPathExecutionContext &executionContext, XalanNode *context, OpCodeMapPositionType opPos, OpCodeMapValueType stepType, MutableNodeRefList &subQueryResults) const
XalanVector< TargetData > TargetDataVectorType
Definition: XPath.hpp:148
void group(XalanNode *context, OpCodeMapPositionType opPos, XPathExecutionContext &executionContext, bool &theResult) const
Execute an expression as a group.
Definition: XPath.hpp:1897
virtual NodeType getNodeType() const =0
An enum value representing the type of the underlying object.
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)