]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathElement.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / tree / xpath / XPathElement.h
1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2  * Use of this file is governed by the BSD 3-clause license that
3  * can be found in the LICENSE.txt file in the project root.
4  */
5
6 #pragma once
7
8 #include "antlr4-common.h"
9
10 namespace antlr4 {
11 namespace tree {
12   class ParseTree;
13
14 namespace xpath {
15
16   class ANTLR4CPP_PUBLIC XPathElement {
17   public:
18     /// Construct element like {@code /ID} or {@code ID} or {@code /*} etc...
19     ///  op is null if just node
20     XPathElement(const std::string &nodeName);
21     XPathElement(XPathElement const&) = default;
22     virtual ~XPathElement();
23
24     XPathElement& operator=(XPathElement const&) = default;
25
26     /// Given tree rooted at {@code t} return all nodes matched by this path
27     /// element.
28     virtual std::vector<ParseTree *> evaluate(ParseTree *t);
29     virtual std::string toString() const;
30
31     void setInvert(bool value);
32
33   protected:
34     std::string _nodeName;
35     bool _invert = false;
36   };
37
38 } // namespace xpath
39 } // namespace tree
40 } // namespace antlr4