]> gitweb.ps.run Git - toc/blob - antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/pattern/TextChunk.h
add antlr source code and ReadMe
[toc] / antlr4-cpp-runtime-4.9.2-source / runtime / src / tree / pattern / TextChunk.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 "Chunk.h"
9
10 namespace antlr4 {
11 namespace tree {
12 namespace pattern {
13
14   /// <summary>
15   /// Represents a span of raw text (concrete syntax) between tags in a tree
16   /// pattern string.
17   /// </summary>
18   class ANTLR4CPP_PUBLIC TextChunk : public Chunk {
19   private:
20     /// <summary>
21     /// This is the backing field for <seealso cref="#getText"/>.
22     /// </summary>
23     const std::string text;
24
25     /// <summary>
26     /// Constructs a new instance of <seealso cref="TextChunk"/> with the specified text.
27     /// </summary>
28     /// <param name="text"> The text of this chunk. </param>
29     /// <exception cref="IllegalArgumentException"> if {@code text} is {@code null}. </exception>
30   public:
31     TextChunk(const std::string &text);
32     virtual ~TextChunk();
33
34     /// <summary>
35     /// Gets the raw text of this chunk.
36     /// </summary>
37     /// <returns> The text of the chunk. </returns>
38     std::string getText();
39
40     /// <summary>
41     /// {@inheritDoc}
42     /// <p/>
43     /// The implementation for <seealso cref="TextChunk"/> returns the result of
44     /// <seealso cref="#getText()"/> in single quotes.
45     /// </summary>
46     virtual std::string toString() override;
47   };
48
49 } // namespace pattern
50 } // namespace tree
51 } // namespace antlr4