Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XPathProcessorImpl.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(XPATHPROCESSORIMPL_HEADER_GUARD_1357924680)
17 #define XPATHPROCESSORIMPL_HEADER_GUARD_1357924680
18 
19 
20 
21 // Base header file. Must be first.
23 
24 
25 
26 #include <cstdlib>
27 
28 
29 
31 
32 
33 
36 
37 
38 
40 
41 
42 
43 // Base class header file...
45 
46 
47 
48 #include <xalanc/XPath/XPath.hpp>
49 
50 
51 
52 XALAN_CPP_NAMESPACE_BEGIN
53 
54 
55 
56 class XalanNode;
57 
58 
59 
65 {
66 public:
67 
68  typedef XalanMap<XalanDOMString,
70 
72 
74 
75  virtual
77 
78 
79  static XPathProcessorImpl*
80  create(MemoryManagerType& theManager);
81  // These are inherited from XPathProcessor...
82 
83  virtual void
84  initXPath(
85  XPath& pathObj,
86  XPathConstructionContext& constructionContext,
87  const XalanDOMString& expression,
88  const PrefixResolver& resolver,
89  const LocatorType* locator = 0,
90  bool allowVariableReferences = true,
91  bool allowKeyFunction = true);
92 
93  virtual void
95  XPath& pathObj,
96  XPathConstructionContext& constructionContext,
97  const XalanDOMString& expression,
98  const PrefixResolver& resolver,
99  const LocatorType* locator = 0,
100  bool allowVariableReferences = true,
101  bool allowKeyFunction = true);
102 
103 private:
104 
111  void
112  tokenize(const XalanDOMString& pat);
113 
114  void
115  addToTokenQueue(const XalanDOMString& s) const;
116 
117  void
118  replaceTokenWithNamespaceToken() const;
119 
124  int
125  mapNSTokens(
126  const XalanDOMString& pat,
127  int startSubstring,
128  int posOfNSSep,
129  int posOfScan);
130 
136  bool
137  tokenIs(const XalanDOMString& s) const;
138 
144  bool
145  tokenIs(const XalanDOMChar* s) const;
146 
152  bool
153  tokenIs(XalanDOMChar c) const;
154 
162  bool
163  lookahead(
164  XalanDOMChar c,
165  int n) const;
166 
174  bool
175  lookahead(
176  const XalanDOMChar* s,
177  int n) const;
178 
186  bool
187  lookahead(
188  const XalanDOMString& s,
189  int n) const;
190 
201  bool
202  lookbehind(
203  char c,
204  int n) const;
205 
216  bool
217  lookbehindHasToken(int n) const;
218 
223  bool
224  nextToken();
225 
230  const XalanDOMString&
231  getTokenRelative(int theOffset) const;
232 
237  void
238  prevToken();
239 
244  void
245  consumeExpected(XalanDOMChar expected);
246 
247  bool
248  isCurrentLiteral() const;
249 
256  static bool
257  isAxis(const XalanDOMString& theToken);
258 
265  static bool
266  isNodeTest(const XalanDOMString& theToken);
267 
271  void
272  error(const XalanDOMString& msg) const;
273 
277  void
278  error(XalanMessages::Codes theCode) const;
279 
280  void
281  error(
282  XalanMessages::Codes theCode,
283  const XalanDOMString& theToken) const;
284 
285  void
286  error(
287  XalanMessages::Codes theCode,
288  const XalanDOMChar* theToken) const;
289 
290  void
291  error(
292  XalanMessages::Codes theCode,
293  XalanDOMChar theToken1,
294  const XalanDOMString& theToken2) const;
295 
300  getFunctionToken(const XalanDOMString& key)
301  {
302  return searchTable(s_functionTable, s_functionTableSize, key).m_opCode;
303  }
304 
309  getNodeTypeToken(const XalanDOMString& key)
310  {
311  return searchTable(s_nodeTypeTable, s_nodeTypeTableSize, key).m_opCode;
312  }
313 
318  getAxisToken(const XalanDOMString& key)
319  {
320  return searchTable(s_axisTable, s_axisTableSize, key).m_opCode;
321  }
322 
329  void
330  Expr();
331 
332 
340  void
341  OrExpr();
342 
350  void
351  AndExpr() ;
352 
362  int
363  EqualityExpr(int opCodePos = -1);
364 
377  int
378  RelationalExpr(int opCodePos = -1);
379 
390  int
391  AdditiveExpr(int opCodePos = -1);
392 
405  int
406  MultiplicativeExpr(int opCodePos = -1);
407 
417  void
418  UnaryExpr();
419 
431  void
432  UnionExpr();
433 
445  void
446  PathExpr();
447 
457  void
458  FilterExpr();
459 
469  void
470  PrimaryExpr();
471 
472 
478  void
479  Argument();
480 
486  void
487  FunctionCall();
488 
489  void
490  FunctionPosition();
491 
492  void
493  FunctionLast();
494 
495  void
496  FunctionCount();
497 
498  void
499  FunctionNot();
500 
501  void
502  FunctionTrue();
503 
504  void
505  FunctionFalse();
506 
507  void
508  FunctionBoolean();
509 
510  void
511  FunctionName(int opPos);
512 
513  void
514  FunctionLocalName(int opPos);
515 
516  void
517  FunctionNumber(int opPos);
518 
519  void
520  FunctionFloor();
521 
522  void
523  FunctionCeiling();
524 
525  void
526  FunctionRound();
527 
528  void
529  FunctionString(int opPos);
530 
531  void
532  FunctionStringLength(int opPos);
533 
534  void
535  FunctionSum();
536 
537  void
538  FunctionNamespaceURI(int opPos);
539 
546  void
547  LocationPath();
548 
556  void
557  RelativeLocationPath();
558 
564  void
565  Step();
566 
572  void
573  Basis();
574 
581  AxisName();
582 
589  int
590  NodeTest();
591 
597  void
598  Predicate();
599 
605  void
606  PredicateExpr();
607 
613  void
614  QName();
615 
620  void
621  NCName();
622 
631  void
632  Literal();
633 
639  void
640  Number();
641 
648  void
649  Pattern();
650 
659  void
660  LocationPathPattern();
661 
669  void
670  IdKeyPattern();
671 
679  void
680  RelativePathPattern();
681 
687  void
688  StepPattern();
689 
695  void
696  AbbreviatedNodeTestStep();
697 
698  static bool
699  isValidFunction(const XalanDOMString& key);
700 
701 private:
702 
703  int
704  FunctionCallArguments();
705 
706  struct TableEntry
707  {
708  const XalanDOMChar* m_string;
709 
710  XPathExpression::eOpCodes m_opCode;
711  };
712 
713 #if defined(XALAN_STRICT_ANSI_HEADERS)
714  typedef std::size_t size_type;
715 #else
716  typedef size_t size_type;
717 #endif
718 
719  static const TableEntry&
720  searchTable(
721  const TableEntry theTable[],
722  size_type theTableSize,
723  const XalanDOMString& theString);
724 
728  XalanDOMString m_token;
729 
735  XalanDOMChar m_tokenChar;
736 
740  XPath* m_xpath;
741 
745  XPathConstructionContext* m_constructionContext;
746 
750  XPathExpression* m_expression;
751 
755  const PrefixResolver* m_prefixResolver;
756 
757  bool m_requireLiterals;
758 
759  bool m_isMatchPattern;
760 
761  const LocatorType* m_locator;
762 
763  BoolVectorType m_positionPredicateStack;
764 
765  StringToStringMapType m_namespaces;
766 
767  bool m_allowVariableReferences;
768 
769  bool m_allowKeyFunction;
770 
771  // Static stuff here...
772  static const XalanDOMString s_emptyString;
773 
774  static const XalanDOMChar s_functionIDString[];
775 
776  // This shouldn't really be here, since it's not part of the XPath standard,
777  // but rather a part ofthe XSLT standard.
778  static const XalanDOMChar s_functionKeyString[];
779 
780  static const XalanDOMChar s_orString[];
781 
782  static const XalanDOMChar s_andString[];
783 
784  static const XalanDOMChar s_divString[];
785 
786  static const XalanDOMChar s_modString[];
787 
788  static const XalanDOMChar s_dotString[];
789 
790  static const XalanDOMChar s_dotDotString[];
791 
792  static const XalanDOMChar s_axisString[];
793 
794  static const XalanDOMChar s_attributeString[];
795 
796  static const XalanDOMChar s_childString[];
797 
798  static const XalanDOMChar s_lastString[];
799 
800  static const XalanDOMChar s_positionString[];
801 
802  static const XalanDOMChar s_asteriskString[];
803 
804  static const XalanDOMChar s_commentString[];
805 
806  static const XalanDOMChar s_piString[];
807 
808  static const XalanDOMChar s_nodeString[];
809 
810  static const XalanDOMChar s_textString[];
811 
812  static const XalanDOMChar s_ancestorString[];
813 
814  static const XalanDOMChar s_ancestorOrSelfString[];
815 
816  static const XalanDOMChar s_descendantString[];
817 
818  static const XalanDOMChar s_descendantOrSelfString[];
819 
820  static const XalanDOMChar s_followingString[];
821 
822  static const XalanDOMChar s_followingSiblingString[];
823 
824  static const XalanDOMChar s_parentString[];
825 
826  static const XalanDOMChar s_precedingString[];
827 
828  static const XalanDOMChar s_precedingSiblingString[];
829 
830  static const XalanDOMChar s_selfString[];
831 
832  static const XalanDOMChar s_namespaceString[];
833 
834  static const TableEntry s_functionTable[];
835 
836  static const size_type s_functionTableSize;
837 
838  static const TableEntry s_nodeTypeTable[];
839 
840  static const size_type s_nodeTypeTableSize;
841 
842  static const TableEntry s_axisTable[];
843 
844  static const size_type s_axisTableSize;
845 
846  static const TableEntry s_dummyEntry;
847 };
848 
849 
850 
851 XALAN_CPP_NAMESPACE_END
852 
853 
854 
855 #endif // XPATHPROCESSORIMPL_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