Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XPath.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(XPATH_HEADER_GUARD_1357924680)
17 #define XPATH_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base header file. Must be first.
23 
24 
25 
27 
28 
29 
31 
32 
33 
34 // Base class header files...
36 
37 
38 
43 
44 
45 
46 XALAN_DECLARE_XERCES_CLASS(Locator)
47 
48 
49 
50 XALAN_CPP_NAMESPACE_BEGIN
51 
52 
53 
54 class PrefixResolver;
55 class XObject;
56 class XalanElement;
57 class XalanNode;
59 
60 
61 
63 {
64 public:
65 
66  typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType;
67 
74 
75 
76  static const XalanDOMChar PSEUDONAME_ANY[];
77  static const XalanDOMChar PSEUDONAME_ROOT[];
78  static const XalanDOMChar PSEUDONAME_TEXT[];
79  static const XalanDOMChar PSEUDONAME_COMMENT[];
80  static const XalanDOMChar PSEUDONAME_PI[];
81  static const XalanDOMChar PSEUDONAME_OTHER[];
82  static const XalanDOMChar PSEUDONAME_NODE[];
83 
85  {
90  eMatchScoreOther
91  };
92 
93  class TargetData
94  {
95  public:
96 
97  enum eTargetType { eAttribute, eElement, eAny, eOther };
98 
100  m_string(0),
101  m_priority(eMatchScoreNone),
102  m_targetType(eOther)
103  {
104  }
105 
107  const XalanDOMChar* theString,
108  eMatchScore thePriority,
109  eTargetType theTargetType) :
110  m_string(theString),
111  m_priority(thePriority),
112  m_targetType(theTargetType)
113  {
114  }
115 
116  const XalanDOMChar*
117  getString() const
118  {
119  return m_string;
120  }
121 
124  {
125  return m_priority;
126  }
127 
128  eTargetType
130  {
131  return m_targetType;
132  }
133 
134  private:
135 
136  const XalanDOMChar* m_string;
137 
138  eMatchScore m_priority;
139 
140  eTargetType m_targetType;
141  };
142 
144 
148  static void
149  initialize(MemoryManagerType& theManager);
150 
154  static void
155  terminate();
156 
162  explicit
163  XPath(MemoryManagerType& theManager, const LocatorType* theLocator = 0);
164 
165  static XPath*
166  create(MemoryManagerType& theManager, const LocatorType* theLocator = 0);
167 
170  {
171  return m_expression.getMemoryManager();
172  }
173  ~XPath();
174 
178  void
180  {
181  m_expression.shrink();
182  }
183 
192  const XObjectPtr
193  execute(
194  XalanNode* context,
195  const PrefixResolver& prefixResolver,
196  XPathExecutionContext& executionContext) const;
197 
206  void
207  execute(
208  XalanNode* context,
209  const PrefixResolver& prefixResolver,
210  XPathExecutionContext& executionContext,
211  bool& result) const;
212 
221  void
222  execute(
223  XalanNode* context,
224  const PrefixResolver& prefixResolver,
225  XPathExecutionContext& executionContext,
226  double& result) const;
227 
237  void
238  execute(
239  XalanNode* context,
240  const PrefixResolver& prefixResolver,
241  XPathExecutionContext& executionContext,
242  XalanDOMString& result) const;
243 
244  typedef void (FormatterListener::*MemberFunctionPtr)(const XMLCh* const, const unsigned int);
245 
255  void
256  execute(
257  XalanNode* context,
258  const PrefixResolver& prefixResolver,
259  XPathExecutionContext& executionContext,
260  FormatterListener& formatterListener,
261  MemberFunctionPtr function) const;
262 
282  const XObjectPtr
283  execute(
284  XalanNode* context,
285  const PrefixResolver& prefixResolver,
286  XPathExecutionContext& executionContext,
287  MutableNodeRefList& result) const;
288 
298  const XObjectPtr
300  XalanNode* context,
301  const PrefixResolver& prefixResolver,
302  const NodeRefListBase& contextNodeList,
303  XPathExecutionContext& executionContext) const
304  {
305  // Push and pop the context node list...
307  executionContext,
308  contextNodeList);
309 
310  return execute(context, prefixResolver, executionContext);
311  }
312 
322  void
324  XalanNode* context,
325  const PrefixResolver& prefixResolver,
326  const NodeRefListBase& contextNodeList,
327  XPathExecutionContext& executionContext,
328  bool& result) const
329  {
330  // Push and pop the context node list...
332  executionContext,
333  contextNodeList);
334 
335  execute(context, prefixResolver, executionContext, result);
336  }
337 
347  void
349  XalanNode* context,
350  const PrefixResolver& prefixResolver,
351  const NodeRefListBase& contextNodeList,
352  XPathExecutionContext& executionContext,
353  double& result) const
354  {
355  // Push and pop the context node list...
357  executionContext,
358  contextNodeList);
359 
360  execute(context, prefixResolver, executionContext, result);
361  }
362 
373  void
375  XalanNode* context,
376  const PrefixResolver& prefixResolver,
377  const NodeRefListBase& contextNodeList,
378  XPathExecutionContext& executionContext,
379  XalanDOMString& result) const
380  {
381  // Push and pop the context node list...
383  executionContext,
384  contextNodeList);
385 
386  execute(context, prefixResolver, executionContext, result);
387  }
388 
399  void
401  XalanNode* context,
402  const PrefixResolver& prefixResolver,
403  const NodeRefListBase& contextNodeList,
404  XPathExecutionContext& executionContext,
405  FormatterListener& formatterListener,
406  MemberFunctionPtr function) const
407  {
408  // Push and pop the context node list...
410  executionContext,
411  contextNodeList);
412 
413  execute(context, prefixResolver, executionContext, formatterListener, function);
414  }
415 
436  const XObjectPtr
438  XalanNode* context,
439  const PrefixResolver& prefixResolver,
440  const NodeRefListBase& contextNodeList,
441  XPathExecutionContext& executionContext,
442  MutableNodeRefList& result) const
443  {
444  // Push and pop the context node list...
446  executionContext,
447  contextNodeList);
448 
449  return execute(context, prefixResolver, executionContext, result);
450  }
451 
461  const XObjectPtr
462  execute(XPathExecutionContext& executionContext) const
463  {
464  assert(executionContext.getCurrentNode() != 0);
465  assert(executionContext.getPrefixResolver() != 0);
466 
467  return executeMore(
468  executionContext.getCurrentNode(),
469  getInitialOpCodePosition(),
470  executionContext);
471  }
472 
482  void
484  XPathExecutionContext& executionContext,
485  bool& result) const
486  {
487  assert(executionContext.getCurrentNode() != 0);
488  assert(executionContext.getPrefixResolver() != 0);
489 
490  executeMore(
491  executionContext.getCurrentNode(),
492  getInitialOpCodePosition(),
493  executionContext,
494  result);
495  }
496 
506  void
508  XPathExecutionContext& executionContext,
509  double& result) const
510  {
511  assert(executionContext.getCurrentNode() != 0);
512  assert(executionContext.getPrefixResolver() != 0);
513 
514  executeMore(
515  executionContext.getCurrentNode(),
516  getInitialOpCodePosition(),
517  executionContext,
518  result);
519  }
520 
531  void
533  XPathExecutionContext& executionContext,
534  XalanDOMString& result) const
535  {
536  assert(executionContext.getCurrentNode() != 0);
537  assert(executionContext.getPrefixResolver() != 0);
538 
539  executeMore(
540  executionContext.getCurrentNode(),
541  getInitialOpCodePosition(),
542  executionContext,
543  result);
544  }
545 
556  void
558  XPathExecutionContext& executionContext,
559  FormatterListener& formatterListener,
560  MemberFunctionPtr function) const
561  {
562  assert(executionContext.getCurrentNode() != 0);
563  assert(executionContext.getPrefixResolver() != 0);
564 
565  executeMore(
566  executionContext.getCurrentNode(),
567  getInitialOpCodePosition(),
568  executionContext,
569  formatterListener,
570  function);
571  }
572 
593  const XObjectPtr
595  XPathExecutionContext& executionContext,
596  MutableNodeRefList& result) const
597  {
598  assert(executionContext.getCurrentNode() != 0);
599  assert(executionContext.getPrefixResolver() != 0);
600 
601  return executeMore(
602  executionContext.getCurrentNode(),
603  getInitialOpCodePosition(),
604  executionContext,
605  result);
606  }
607 
618  const XObjectPtr
620  const PrefixResolver& prefixResolver,
621  XPathExecutionContext& executionContext) const
622  {
623  assert(executionContext.getCurrentNode() != 0);
624 
625  // Push and pop the PrefixResolver...
626  const PrefixResolverSetAndRestore theResolverSetAndRestore(
627  executionContext,
628  &prefixResolver);
629 
630  return executeMore(
631  executionContext.getCurrentNode(),
632  getInitialOpCodePosition(),
633  executionContext);
634  }
635 
646  void
648  const PrefixResolver& prefixResolver,
649  XPathExecutionContext& executionContext,
650  bool& result) const
651  {
652  assert(executionContext.getCurrentNode() != 0);
653 
654  // Push and pop the PrefixResolver...
655  const PrefixResolverSetAndRestore theResolverSetAndRestore(
656  executionContext,
657  &prefixResolver);
658 
659  executeMore(
660  executionContext.getCurrentNode(),
661  getInitialOpCodePosition(),
662  executionContext,
663  result);
664  }
665 
676  void
678  const PrefixResolver& prefixResolver,
679  XPathExecutionContext& executionContext,
680  double& result) const
681  {
682  assert(executionContext.getCurrentNode() != 0);
683 
684  // Push and pop the PrefixResolver...
685  const PrefixResolverSetAndRestore theResolverSetAndRestore(
686  executionContext,
687  &prefixResolver);
688 
689  executeMore(
690  executionContext.getCurrentNode(),
691  getInitialOpCodePosition(),
692  executionContext,
693  result);
694  }
695 
707  void
709  const PrefixResolver& prefixResolver,
710  XPathExecutionContext& executionContext,
711  XalanDOMString& result) const
712  {
713  assert(executionContext.getCurrentNode() != 0);
714 
715  // Push and pop the PrefixResolver...
716  const PrefixResolverSetAndRestore theResolverSetAndRestore(
717  executionContext,
718  &prefixResolver);
719 
720  executeMore(
721  executionContext.getCurrentNode(),
722  getInitialOpCodePosition(),
723  executionContext,
724  result);
725  }
726 
735  void
737  const PrefixResolver& prefixResolver,
738  XPathExecutionContext& executionContext,
739  FormatterListener& formatterListener,
740  MemberFunctionPtr function) const
741  {
742  assert(executionContext.getCurrentNode() != 0);
743 
744  // Push and pop the PrefixResolver...
745  const PrefixResolverSetAndRestore theResolverSetAndRestore(
746  executionContext,
747  &prefixResolver);
748 
749  executeMore(
750  executionContext.getCurrentNode(),
751  getInitialOpCodePosition(),
752  executionContext,
753  formatterListener,
754  function);
755  }
756 
778  XObjectPtr
780  const PrefixResolver& prefixResolver,
781  XPathExecutionContext& executionContext,
782  MutableNodeRefList& result) const
783  {
784  assert(executionContext.getCurrentNode() != 0);
785 
786  // Push and pop the PrefixResolver...
787  const PrefixResolverSetAndRestore theResolverSetAndRestore(
788  executionContext,
789  &prefixResolver);
790 
791  return executeMore(
792  executionContext.getCurrentNode(),
793  getInitialOpCodePosition(),
794  executionContext,
795  result);
796  }
797 
805  {
806  return m_expression;
807  }
808 
814  const XPathExpression&
816  {
817  return m_expression;
818  }
819 
820  static double
822  {
823  switch(score)
824  {
825  case eMatchScoreNone:
827  break;
828 
829  case eMatchScoreNodeTest:
830  return -0.5;
831  break;
832 
833  case eMatchScoreNSWild:
834  return -0.25;
835  break;
836 
837  case eMatchScoreOther:
838  return 0.5;
839  break;
840 
841  case eMatchScoreQName:
842  return 0.0;
843  break;
844  };
845 
846  assert(false);
847  return 0.0;
848  }
849 
857  eMatchScore
858  getMatchScore(
859  XalanNode* node,
860  XPathExecutionContext& executionContext) const;
861 
870  eMatchScore
871  getMatchScore(
872  XalanNode* node,
873  const PrefixResolver& resolver,
874  XPathExecutionContext& executionContext) const;
875 
884  const XObjectPtr
886  XalanNode* context,
887  OpCodeMapPositionType opPos,
888  XPathExecutionContext& executionContext) const
889  {
890  return executeMore(context, opPos + 2, executionContext);
891  }
892 
898  void
899  getTargetData(TargetDataVectorType& targetData) const;
900 
907  static void
909  const XalanDOMString& funcName,
910  const Function& func)
911  {
912  s_functions.InstallFunction(funcName,
913  func);
914  }
915 
922  static void
924  const XalanDOMChar* funcName,
925  const Function& func)
926  {
927  s_functions.InstallFunction(funcName,
928  func);
929  }
930 
937  static bool
939  {
940  return s_functions.UninstallFunction(funcName);
941  }
942 
949  static bool
950  uninstallFunction(const XalanDOMChar* funcName)
951  {
952  return s_functions.UninstallFunction(funcName);
953  }
954 
961  static bool
962  isInstalledFunction(const XalanDOMString& theFunctionName)
963  {
964  return s_functions.isInstalledFunction(theFunctionName);
965  }
966 
968 
974  static const FunctionTableType&
976  {
977  return s_functions;
978  }
979 
980 #if defined(XALAN_NO_MEMBER_TEMPLATES)
981  typedef XPathFunctionTable::InstalledFunctionNameVectorType
982  InstalledFunctionNameVectorType;
983 
989  static void
990  getInstalledFunctionNames(InstalledFunctionNameVectorType& theVector)
991  {
992  s_functions.getInstalledFunctionNames(theVector);
993  }
994 #else
995 
1000  template<class OutputIteratorType>
1001  static void
1002  getInstalledFunctionNames(OutputIteratorType theIterator)
1003  {
1004  s_functions.getInstalledFunctionNames(theIterator);
1005  }
1006 #endif
1007 
1008  static void
1010  {
1011  s_functions.DestroyTable();
1012  }
1013 
1014  bool
1016  {
1017  return m_inStylesheet;
1018  }
1019 
1020  void
1021  setInStylesheet(bool fValue)
1022  {
1023  m_inStylesheet = fValue;
1024  }
1025 
1026  const LocatorType*
1027  getLocator() const
1028  {
1029  return m_locator;
1030  }
1031 
1032  void
1033  setLocator(const LocatorType* theLocator)
1034  {
1035  m_locator = theLocator;
1036  }
1037 
1039  {
1040  public:
1041 
1042  NodeTester();
1043 
1044  NodeTester(const NodeTester& theSource);
1045 
1046  NodeTester(
1047  const XPath& xpath,
1048  XPathExecutionContext& executionContext,
1049  OpCodeMapPositionType opPos,
1050  OpCodeMapValueType argLen,
1051  OpCodeMapValueType stepType);
1052 
1053  NodeTester(
1054  XPathConstructionContext& theContext,
1055  const XalanDOMString& theNameTest,
1056  const PrefixResolver& thePrefixResolver,
1057  const LocatorType* theLocator = 0,
1058  eMatchScore* theMatchScore = 0);
1059 
1060  NodeTester(
1061  const XalanDOMString& theNamespaceURI,
1062  const XalanDOMString& theLocalName,
1063  eMatchScore* theMatchScore = 0);
1064 
1065  eMatchScore
1067  const XalanNode& context,
1068  XalanNode::NodeType nodeType) const
1069  {
1070  assert(context.getNodeType() == nodeType);
1071 
1072  return (this->*m_testFunction)(context, nodeType);
1073  }
1074 
1075  eMatchScore
1076  operator()(const XalanElement& context) const
1077  {
1078  return (this->*m_testFunction2)(context);
1079  }
1080 
1081  NodeTester&
1082  operator=(const NodeTester& theRHS)
1083  {
1084  m_executionContext = theRHS.m_executionContext;
1085  m_targetNamespace = theRHS.m_targetNamespace;
1086  m_targetLocalName = theRHS.m_targetLocalName;
1087  m_testFunction = theRHS.m_testFunction;
1088  m_testFunction2 = theRHS.m_testFunction2;
1089 
1090  return *this;
1091  }
1092 
1093  protected:
1094 
1095  eMatchScore
1096  initialize(
1097  XPathConstructionContext& theConstructionContext,
1098  const XalanDOMString& theNameTest,
1099  const PrefixResolver& thePrefixResolver,
1100  const LocatorType* theLocator);
1101 
1102  eMatchScore
1103  initialize(
1104  const XalanDOMString& theNamespaceURI,
1105  const XalanDOMString& theLocalName);
1106 
1107  private:
1108 
1109 
1110  typedef eMatchScore (NodeTester::*TestFunctionPtr)(const XalanNode&, XalanNode::NodeType) const;
1111  typedef eMatchScore (NodeTester::*TestFunctionPtr2)(const XalanElement&) const;
1112 
1113 
1114  eMatchScore
1115  testComment(
1116  const XalanNode& context,
1117  XalanNode::NodeType nodeType) const;
1118 
1119  eMatchScore
1120  testText(
1121  const XalanNode& context,
1122  XalanNode::NodeType nodeType) const;
1123 
1124  eMatchScore
1125  testPI(
1126  const XalanNode& context,
1127  XalanNode::NodeType nodeType) const;
1128 
1129  eMatchScore
1130  testPIName(
1131  const XalanNode& context,
1132  XalanNode::NodeType nodeType) const;
1133 
1134  eMatchScore
1135  testNode(
1136  const XalanNode& context,
1137  XalanNode::NodeType nodeType) const;
1138 
1139  eMatchScore
1140  testRoot(
1141  const XalanNode& context,
1142  XalanNode::NodeType nodeType) const;
1143 
1144  eMatchScore
1145  testAttributeNCName(
1146  const XalanNode& context,
1147  XalanNode::NodeType nodeType) const;
1148 
1149  eMatchScore
1150  testAttributeQName(
1151  const XalanNode& context,
1152  XalanNode::NodeType nodeType) const;
1153 
1154  eMatchScore
1155  testAttributeNamespaceOnly(
1156  const XalanNode& context,
1157  XalanNode::NodeType nodeType) const;
1158 
1159  eMatchScore
1160  testAttributeTotallyWild(
1161  const XalanNode& context,
1162  XalanNode::NodeType nodeType) const;
1163 
1164  eMatchScore
1165  testElementNCName(
1166  const XalanNode& context,
1167  XalanNode::NodeType nodeType) const;
1168 
1169  eMatchScore
1170  testElementQName(
1171  const XalanNode& context,
1172  XalanNode::NodeType nodeType) const;
1173 
1174  eMatchScore
1175  testElementNamespaceOnly(
1176  const XalanNode& context,
1177  XalanNode::NodeType nodeType) const;
1178 
1179  eMatchScore
1180  testElementTotallyWild(
1181  const XalanNode& context,
1182  XalanNode::NodeType nodeType) const;
1183 
1184  eMatchScore
1185  testElementNCName2(const XalanElement& context) const;
1186 
1187  eMatchScore
1188  testElementQName2(const XalanElement& context) const;
1189 
1190  eMatchScore
1191  testElementNamespaceOnly2(const XalanElement& context) const;
1192 
1193  eMatchScore
1194  testElementTotallyWild2(const XalanElement& context) const;
1195 
1196  eMatchScore
1197  testNamespaceNCName(
1198  const XalanNode& context,
1199  XalanNode::NodeType nodeType) const;
1200 
1201  eMatchScore
1202  testNamespaceTotallyWild(
1203  const XalanNode& context,
1204  XalanNode::NodeType nodeType) const;
1205 
1206  eMatchScore
1207  testDefault(
1208  const XalanNode& context,
1209  XalanNode::NodeType nodeType) const;
1210 
1211  eMatchScore
1212  testDefault2(const XalanElement& context) const;
1213 
1214  bool
1215  matchLocalName(const XalanNode& context) const;
1216 
1217  bool
1218  matchNamespaceURI(const XalanNode& context) const;
1219 
1220  bool
1221  matchLocalNameAndNamespaceURI(const XalanNode& context) const;
1222 
1223  bool
1224  matchNamespace(const XalanNode& context) const;
1225 
1226  bool
1227  shouldStripSourceNode(const XalanText& context) const;
1228 
1229  // Data members...
1230  XPathExecutionContext* m_executionContext;
1231 
1232  const XalanDOMString* m_targetNamespace;
1233 
1234  const XalanDOMString* m_targetLocalName;
1235 
1236  TestFunctionPtr m_testFunction;
1237 
1238  TestFunctionPtr2 m_testFunction2;
1239  };
1240 
1241  friend class NodeTester;
1242 
1243 protected:
1244 
1253  const XObjectPtr
1254  locationPath(
1255  XalanNode* context,
1256  OpCodeMapPositionType opPos,
1257  XPathExecutionContext& executionContext) const;
1258 
1267  void
1268  locationPath(
1269  XalanNode* context,
1270  OpCodeMapPositionType opPos,
1271  XPathExecutionContext& executionContext,
1272  bool& theResult) const;
1273 
1282  void
1283  locationPath(
1284  XalanNode* context,
1285  OpCodeMapPositionType opPos,
1286  XPathExecutionContext& executionContext,
1287  double& theResult) const;
1288 
1297  void
1298  locationPath(
1299  XalanNode* context,
1300  OpCodeMapPositionType opPos,
1301  XPathExecutionContext& executionContext,
1302  XalanDOMString& theResult) const;
1303 
1313  void
1314  locationPath(
1315  XalanNode* context,
1316  OpCodeMapPositionType opPos,
1317  XPathExecutionContext& executionContext,
1318  FormatterListener& formatterListener,
1319  MemberFunctionPtr function) const;
1320 
1329  void
1331  XalanNode* context,
1332  OpCodeMapPositionType opPos,
1333  XPathExecutionContext& executionContext,
1334  MutableNodeRefList& theResult) const
1335  {
1336  step(executionContext, context, opPos + 2, theResult);
1337  }
1338 
1347  const XObjectPtr
1348  executeMore(
1349  XalanNode* context,
1350  OpCodeMapPositionType opPos,
1351  XPathExecutionContext& executionContext) const;
1352 
1361  void
1362  executeMore(
1363  XalanNode* context,
1364  OpCodeMapPositionType opPos,
1365  XPathExecutionContext& executionContext,
1366  bool& theResult) const;
1367 
1376  void
1377  executeMore(
1378  XalanNode* context,
1379  OpCodeMapPositionType opPos,
1380  XPathExecutionContext& executionContext,
1381  double& theResult) const;
1382 
1392  void
1393  executeMore(
1394  XalanNode* context,
1395  OpCodeMapPositionType opPos,
1396  XPathExecutionContext& executionContext,
1397  XalanDOMString& theResult) const;
1398 
1408  void
1409  executeMore(
1410  XalanNode* context,
1411  OpCodeMapPositionType opPos,
1412  XPathExecutionContext& executionContext,
1413  FormatterListener& formatterListener,
1414  MemberFunctionPtr function) const;
1415 
1425  const XObjectPtr
1426  executeMore(
1427  XalanNode* context,
1428  OpCodeMapPositionType opPos,
1429  XPathExecutionContext& executionContext,
1430  MutableNodeRefList& theResult) const;
1431 
1438  void
1439  doGetMatchScore(
1440  XalanNode* context,
1441  XPathExecutionContext& executionContext,
1442  eMatchScore& score) const;
1443 
1451  bool
1452  Or(
1453  XalanNode* context,
1454  OpCodeMapPositionType opPos,
1455  XPathExecutionContext& executionContext) const;
1456 
1464  bool
1465  And(
1466  XalanNode* context,
1467  OpCodeMapPositionType opPos,
1468  XPathExecutionContext& executionContext) const;
1469 
1477  bool
1478  notequals(
1479  XalanNode* context,
1480  OpCodeMapPositionType opPos,
1481  XPathExecutionContext& executionContext) const;
1482 
1490  bool
1491  equals(
1492  XalanNode* context,
1493  OpCodeMapPositionType opPos,
1494  XPathExecutionContext& executionContext) const;
1495 
1503  bool
1504  lte(
1505  XalanNode* context,
1506  OpCodeMapPositionType opPos,
1507  XPathExecutionContext& executionContext) const;
1508 
1516  bool
1517  lt(
1518  XalanNode* context,
1519  OpCodeMapPositionType opPos,
1520  XPathExecutionContext& executionContext) const;
1521 
1529  bool
1530  gte(
1531  XalanNode* context,
1532  OpCodeMapPositionType opPos,
1533  XPathExecutionContext& executionContext) const;
1534 
1542  bool
1543  gt(
1544  XalanNode* context,
1545  OpCodeMapPositionType opPos,
1546  XPathExecutionContext& executionContext) const;
1547 
1555  double
1556  plus(
1557  XalanNode* context,
1558  OpCodeMapPositionType opPos,
1559  XPathExecutionContext& executionContext) const;
1560 
1569  void
1570  plus(
1571  XalanNode* context,
1572  OpCodeMapPositionType opPos,
1573  XPathExecutionContext& executionContext,
1574  FormatterListener& formatterListener,
1575  MemberFunctionPtr function) const;
1576 
1584  double
1585  minus(
1586  XalanNode* context,
1587  OpCodeMapPositionType opPos,
1588  XPathExecutionContext& executionContext) const;
1589 
1598  void
1599  minus(
1600  XalanNode* context,
1601  OpCodeMapPositionType opPos,
1602  XPathExecutionContext& executionContext,
1603  FormatterListener& formatterListener,
1604  MemberFunctionPtr function) const;
1605 
1613  double
1614  mult(
1615  XalanNode* context,
1616  OpCodeMapPositionType opPos,
1617  XPathExecutionContext& executionContext) const;
1618 
1627  void
1628  mult(
1629  XalanNode* context,
1630  OpCodeMapPositionType opPos,
1631  XPathExecutionContext& executionContext,
1632  FormatterListener& formatterListener,
1633  MemberFunctionPtr function) const;
1634 
1642  double
1643  div(
1644  XalanNode* context,
1645  OpCodeMapPositionType opPos,
1646  XPathExecutionContext& executionContext) const;
1647 
1656  void
1657  div(
1658  XalanNode* context,
1659  OpCodeMapPositionType opPos,
1660  XPathExecutionContext& executionContext,
1661  FormatterListener& formatterListener,
1662  MemberFunctionPtr function) const;
1663 
1671  double
1672  mod(
1673  XalanNode* context,
1674  OpCodeMapPositionType opPos,
1675  XPathExecutionContext& executionContext) const;
1676 
1685  void
1686  mod(
1687  XalanNode* context,
1688  OpCodeMapPositionType opPos,
1689  XPathExecutionContext& executionContext,
1690  FormatterListener& formatterListener,
1691  MemberFunctionPtr function) const;
1692 
1700  double
1701  neg(
1702  XalanNode* context,
1703  OpCodeMapPositionType opPos,
1704  XPathExecutionContext& executionContext) const;
1705 
1714  void
1715  neg(
1716  XalanNode* context,
1717  OpCodeMapPositionType opPos,
1718  XPathExecutionContext& executionContext,
1719  FormatterListener& formatterListener,
1720  MemberFunctionPtr function) const;
1721 
1729  const XObjectPtr
1730  Union(
1731  XalanNode* context,
1732  OpCodeMapPositionType opPos,
1733  XPathExecutionContext& executionContext) const;
1734 
1743  void
1744  Union(
1745  XalanNode* context,
1746  OpCodeMapPositionType opPos,
1747  XPathExecutionContext& executionContext,
1748  bool& result) const;
1749 
1758  void
1759  Union(
1760  XalanNode* context,
1761  OpCodeMapPositionType opPos,
1762  XPathExecutionContext& executionContext,
1763  double& result) const;
1764 
1773  void
1774  Union(
1775  XalanNode* context,
1776  OpCodeMapPositionType opPos,
1777  XPathExecutionContext& executionContext,
1778  XalanDOMString& result) const;
1779 
1789  void
1790  Union(
1791  XalanNode* context,
1792  OpCodeMapPositionType opPos,
1793  XPathExecutionContext& executionContext,
1794  FormatterListener& formatterListener,
1795  MemberFunctionPtr function) const;
1796 
1804  void
1805  Union(
1806  XalanNode* context,
1807  OpCodeMapPositionType opPos,
1808  XPathExecutionContext& executionContext,
1809  MutableNodeRefList& result) const;
1810 
1817  const XObjectPtr
1818  literal(
1819  OpCodeMapPositionType opPos,
1820  XPathExecutionContext& executionContext) const;
1821 
1828  void
1829  literal(
1830  OpCodeMapPositionType opPos,
1831  bool& theResult) const;
1832 
1839  void
1840  literal(
1841  OpCodeMapPositionType opPos,
1842  double& theResult) const;
1843 
1851  void
1852  literal(
1853  OpCodeMapPositionType opPos,
1854  XalanDOMString& theResult) const;
1855 
1862  void
1863  literal(
1864  OpCodeMapPositionType opPos,
1865  FormatterListener& formatterListener,
1866  MemberFunctionPtr function) const;
1867 
1874  const XObjectPtr
1875  variable(
1876  OpCodeMapPositionType opPos,
1877  XPathExecutionContext& executionContext) const;
1878 
1886  const XObjectPtr
1888  XalanNode* context,
1889  OpCodeMapPositionType opPos,
1890  XPathExecutionContext& executionContext) const
1891  {
1892  return executeMore(context, opPos + 2, executionContext);
1893  }
1894 
1902  void
1904  XalanNode* context,
1905  OpCodeMapPositionType opPos,
1906  XPathExecutionContext& executionContext,
1907  bool& theResult) const
1908  {
1909  executeMore(context, opPos + 2, executionContext, theResult);
1910  }
1911 
1919  void
1921  XalanNode* context,
1922  OpCodeMapPositionType opPos,
1923  XPathExecutionContext& executionContext,
1924  double& theResult) const
1925  {
1926  executeMore(context, opPos + 2, executionContext, theResult);
1927  }
1928 
1936  void
1938  XalanNode* context,
1939  OpCodeMapPositionType opPos,
1940  XPathExecutionContext& executionContext,
1941  XalanDOMString& theResult) const
1942  {
1943  executeMore(context, opPos + 2, executionContext, theResult);
1944  }
1945 
1955  void
1957  XalanNode* context,
1958  OpCodeMapPositionType opPos,
1959  XPathExecutionContext& executionContext,
1960  FormatterListener& formatterListener,
1961  MemberFunctionPtr function) const
1962  {
1963  executeMore(context, opPos + 2, executionContext, formatterListener, function);
1964  }
1965 
1973  void
1975  XalanNode* context,
1976  OpCodeMapPositionType opPos,
1977  XPathExecutionContext& executionContext,
1978  MutableNodeRefList& theResult) const
1979  {
1980  executeMore(context, opPos + 2, executionContext, theResult);
1981  }
1982 
1988  double
1989  numberlit(OpCodeMapPositionType opPos) const;
1990 
1996  const XObjectPtr
1997  numberlit(
1998  OpCodeMapPositionType opPos,
1999  XPathExecutionContext& executionContext) const;
2000 
2007  void
2008  numberlit(
2009  OpCodeMapPositionType opPos,
2010  bool& theResult) const;
2011 
2019  void
2020  numberlit(
2021  OpCodeMapPositionType opPos,
2022  XalanDOMString& theResult) const;
2023 
2031  void
2032  numberlit(
2033  OpCodeMapPositionType opPos,
2034  FormatterListener& formatterListener,
2035  MemberFunctionPtr function) const;
2036 
2044  const XObjectPtr
2045  runExtFunction(
2046  XalanNode* context,
2047  OpCodeMapPositionType opPos,
2048  XPathExecutionContext& executionContext) const;
2049 
2059  const XObjectPtr
2061  XalanNode* context,
2062  OpCodeMapPositionType /* opPos */,
2063  const XalanDOMString& theNamespace,
2064  const XalanDOMString& functionName,
2065  const Function::XObjectArgVectorType& argVec,
2066  XPathExecutionContext& executionContext) const
2067  {
2068  return executionContext.extFunction(theNamespace,
2069  functionName,
2070  context,
2071  argVec,
2072  m_locator);
2073  }
2074 
2082  const XObjectPtr
2083  runFunction(
2084  XalanNode* context,
2085  OpCodeMapPositionType opPos,
2086  XPathExecutionContext& executionContext) const;
2087 
2096  const XObjectPtr
2097  function(
2098  XalanNode* context,
2099  OpCodeMapValueType funcID,
2100  const Function::XObjectArgVectorType& argVec,
2101  XPathExecutionContext& executionContext) const
2102  {
2103  return s_functions[funcID].execute(executionContext, context, argVec, m_locator);
2104  }
2105 
2113  double
2115  XalanNode* context,
2116  XPathExecutionContext& executionContext) const
2117  {
2118  assert(context != 0);
2119 
2120  return executionContext.getContextNodeListPosition(*context);
2121  }
2122 
2129  double
2130  functionLast(XPathExecutionContext& executionContext) const
2131  {
2132  return executionContext.getContextNodeListLength();
2133  }
2134 
2143  double
2144  functionCount(
2145  XalanNode* context,
2146  OpCodeMapPositionType opPos,
2147  XPathExecutionContext& executionContext) const;
2148 
2157  bool
2159  XalanNode* context,
2160  OpCodeMapPositionType opPos,
2161  XPathExecutionContext& executionContext) const
2162  {
2163  assert(context != 0);
2164 
2165  return !functionBoolean(context, opPos, executionContext);
2166  }
2167 
2176  bool
2178  XalanNode* context,
2179  OpCodeMapPositionType opPos,
2180  XPathExecutionContext& executionContext) const
2181  {
2182  assert(context != 0);
2183 
2184  bool result;
2185 
2186  executeMore(context, opPos + 2, executionContext, result);
2187 
2188  return result;
2189  }
2190 
2197  const XalanDOMString&
2198  functionName(XalanNode* context) const
2199  {
2200  assert(context != 0);
2201 
2202  return DOMServices::getNameOfNode(*context);
2203  }
2204 
2213  const XalanDOMString&
2214  functionName(
2215  XalanNode* context,
2216  OpCodeMapPositionType opPos,
2217  XPathExecutionContext& executionContext) const;
2218 
2225  const XalanDOMString&
2226  functionLocalName(XalanNode* context) const;
2227 
2236  const XalanDOMString&
2237  functionLocalName(
2238  XalanNode* context,
2239  OpCodeMapPositionType opPos,
2240  XPathExecutionContext& executionContext) const;
2241 
2249  double
2251  XalanNode* context,
2252  XPathExecutionContext& executionContext) const
2253  {
2254  assert(context != 0);
2255 
2256  return XObject::number(executionContext, *context);
2257  }
2258 
2267  double
2269  XalanNode* context,
2270  OpCodeMapPositionType opPos,
2271  XPathExecutionContext& executionContext) const
2272  {
2273  double result;
2274 
2275  executeMore(context, opPos + 2, executionContext, result);
2276 
2277  return result;
2278  }
2279 
2288  double
2290  XalanNode* context,
2291  OpCodeMapPositionType opPos,
2292  XPathExecutionContext& executionContext) const
2293  {
2294  return DoubleSupport::floor(functionNumber(context, opPos, executionContext));
2295  }
2296 
2305  double
2307  XalanNode* context,
2308  OpCodeMapPositionType opPos,
2309  XPathExecutionContext& executionContext) const
2310  {
2311  return DoubleSupport::ceiling(functionNumber(context, opPos, executionContext));
2312  }
2313 
2322  double
2324  XalanNode* context,
2325  OpCodeMapPositionType opPos,
2326  XPathExecutionContext& executionContext) const
2327  {
2328  return DoubleSupport::round(functionNumber(context, opPos, executionContext));
2329  }
2330 
2337  double
2338  functionStringLength(XalanNode* context) const;
2339 
2348  double
2349  functionStringLength(
2350  XalanNode* context,
2351  OpCodeMapPositionType opPos,
2352  XPathExecutionContext& executionContext) const;
2353 
2362  double
2363  functionSum(
2364  XalanNode* context,
2365  OpCodeMapPositionType opPos,
2366  XPathExecutionContext& executionContext) const;
2367 
2375  double
2376  getNumericOperand(
2377  XalanNode* context,
2378  OpCodeMapPositionType opPos,
2379  XPathExecutionContext& executionContext) const;
2380 
2381 private:
2382 
2383  // These are not implemented...
2384  XPath(const XPath&);
2385 
2386  XPath&
2387  operator=(const XPath&);
2388 
2389  bool
2390  operator==(const XPath&) const;
2391 
2392  // Default vector allocation sizes.
2393  enum
2394  {
2395  eDefaultTargetDataSize = 5
2396  };
2397 
2398  OpCodeMapPositionType
2399  getInitialOpCodePosition() const
2400  {
2401 #if defined(XALAN_XPATH_EXPRESSION_USE_ITERATORS)
2402  assert(m_expression.getOpCodeMapValue(0) == XPathExpression::eOP_XPATH);
2403 #else
2404  assert(m_expression.getOpCodeMapValue(
2405  m_expression.getInitialOpCodePosition()) == XPathExpression::eOP_XPATH);
2406 #endif
2407  return m_expression.getInitialOpCodePosition() + 2;
2408  }
2409 
2410  eMatchScore
2411  locationPathPattern(
2412  XPathExecutionContext& executionContext,
2413  XalanNode& context,
2414  OpCodeMapPositionType opPos) const;
2415 
2416 protected:
2417 
2418  void
2419  step(
2420  XPathExecutionContext& executionContext,
2421  XalanNode* context,
2422  OpCodeMapPositionType opPos,
2423  MutableNodeRefList& queryResults) const;
2424 
2435  XalanNode*
2436  stepPattern(
2437  XPathExecutionContext& executionContext,
2438  XalanNode* context,
2439  OpCodeMapPositionType opPos,
2440  eMatchScore& scoreHolder) const;
2441 
2442  OpCodeMapPositionType
2443  findNodeSet(
2444  XPathExecutionContext& executionContext,
2445  XalanNode* context,
2446  OpCodeMapPositionType opPos,
2447  OpCodeMapValueType stepType,
2448  MutableNodeRefList& subQueryResults) const;
2449 
2450  OpCodeMapPositionType
2451  findRoot(
2452  XPathExecutionContext& executionContext,
2453  XalanNode* context,
2454  OpCodeMapPositionType opPos,
2455  OpCodeMapValueType stepType,
2456  MutableNodeRefList& subQueryResults) const;
2457 
2458  OpCodeMapPositionType
2459  findParent(
2460  XPathExecutionContext& executionContext,
2461  XalanNode* context,
2462  OpCodeMapPositionType opPos,
2463  OpCodeMapValueType stepType,
2464  MutableNodeRefList& subQueryResults) const;
2465 
2466  OpCodeMapPositionType
2467  findSelf(
2468  XPathExecutionContext& executionContext,
2469  XalanNode* context,
2470  OpCodeMapPositionType opPos,
2471  OpCodeMapValueType stepType,
2472  MutableNodeRefList& subQueryResults) const;
2473 
2474  OpCodeMapPositionType
2475  findAncestors(
2476  XPathExecutionContext& executionContext,
2477  XalanNode* context,
2478  OpCodeMapPositionType opPos,
2479  OpCodeMapValueType stepType,
2480  MutableNodeRefList& subQueryResults) const;
2481 
2482  OpCodeMapPositionType
2483  findAncestorsOrSelf(
2484  XPathExecutionContext& executionContext,
2485  XalanNode* context,
2486  OpCodeMapPositionType opPos,
2487  OpCodeMapValueType stepType,
2488  MutableNodeRefList& subQueryResults) const;
2489 
2490  OpCodeMapPositionType
2491  findAttributes(
2492  XPathExecutionContext& executionContext,
2493  XalanNode* context,
2494  OpCodeMapPositionType opPos,
2495  OpCodeMapValueType stepType,
2496  MutableNodeRefList& subQueryResults) const;
2497 
2498  OpCodeMapPositionType
2499  findChildren(
2500  XPathExecutionContext& executionContext,
2501  XalanNode* context,
2502  OpCodeMapPositionType opPos,
2503  OpCodeMapValueType stepType,
2504  MutableNodeRefList& subQueryResults) const;
2505 
2506  OpCodeMapPositionType
2507  findDescendants(
2508  XPathExecutionContext& executionContext,
2509  XalanNode* context,
2510  OpCodeMapPositionType opPos,
2511  OpCodeMapValueType stepType,
2512  MutableNodeRefList& subQueryResults) const;
2513 
2514  OpCodeMapPositionType
2515  findFollowing(
2516  XPathExecutionContext& executionContext,
2517  XalanNode* context,
2518  OpCodeMapPositionType opPos,
2519  OpCodeMapValueType stepType,
2520  MutableNodeRefList& subQueryResults) const;
2521 
2522  OpCodeMapPositionType
2523  findFollowingSiblings(
2524  XPathExecutionContext& executionContext,
2525  XalanNode* context,
2526  OpCodeMapPositionType opPos,
2527  OpCodeMapValueType stepType,
2528  MutableNodeRefList& subQueryResults) const;
2529 
2530  OpCodeMapPositionType
2531  findPreceeding(
2532  XPathExecutionContext& executionContext,
2533  XalanNode* context,
2534  OpCodeMapPositionType opPos,
2535  OpCodeMapValueType stepType,
2536  MutableNodeRefList& subQueryResults) const;
2537 
2538  OpCodeMapPositionType
2539  findPreceedingSiblings(
2540  XPathExecutionContext& executionContext,
2541  XalanNode* context,
2542  OpCodeMapPositionType opPos,
2543  OpCodeMapValueType stepType,
2544  MutableNodeRefList& subQueryResults) const;
2545 
2546  OpCodeMapPositionType
2547  findNamespace(
2548  XPathExecutionContext& executionContext,
2549  XalanNode* context,
2550  OpCodeMapPositionType opPos,
2551  OpCodeMapValueType stepType,
2552  MutableNodeRefList& subQueryResults) const;
2553 
2554  OpCodeMapPositionType
2555  findNodesOnUnknownAxis(
2556  XPathExecutionContext& executionContext,
2557  XalanNode* context,
2558  OpCodeMapPositionType opPos,
2559  OpCodeMapValueType stepType,
2560  MutableNodeRefList& subQueryResults) const;
2561 
2562 #if !defined(NDEBUG)
2563  eMatchScore
2564  nodeTest(
2565  XPathExecutionContext& executionContext,
2566  XalanNode* context,
2567  XalanNode::NodeType nodeType,
2568  OpCodeMapPositionType opPos,
2569  OpCodeMapValueType argLen,
2570  OpCodeMapValueType stepType) const;
2571 #endif
2572 
2573  OpCodeMapPositionType
2574  predicates(
2575  XPathExecutionContext& executionContext,
2576  OpCodeMapPositionType opPos,
2577  MutableNodeRefList& subQueryResults) const;
2578 
2579  eMatchScore
2580  handleFoundIndex(
2581  XPathExecutionContext& executionContext,
2582  XalanNode* localContext,
2583  OpCodeMapPositionType startOpPos) const;
2584 
2585  eMatchScore
2586  handleFoundIndexPositional(
2587  XPathExecutionContext& executionContext,
2588  XalanNode* localContext,
2589  OpCodeMapPositionType startOpPos) const;
2590 
2591 private:
2592 
2593  void
2594  unknownOpCodeError(
2595  XalanNode* context,
2596  XPathExecutionContext& executionContext,
2597  OpCodeMapPositionType opPos) const;
2598 
2599  void
2600  notNodeSetError(
2601  XalanNode* context,
2602  XPathExecutionContext& executionContext) const;
2603 
2604  // Data members...
2605 
2611  XPathExpression m_expression;
2612 
2616  const LocatorType* m_locator;
2617 
2623  bool m_inStylesheet;
2624 
2630  static FunctionTableType s_functions;
2631 
2632  static const XalanDOMString s_emptyString;
2633 };
2634 
2635 
2636 
2637 XALAN_CPP_NAMESPACE_END
2638 
2639 
2640 
2641 #endif // XPATH_HEADER_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo