retdec
node_array.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_NODE_ARRAY_H
8 #define RETDEC_NODE_ARRAY_H
9 
11 
12 namespace retdec {
13 namespace demangler {
14 namespace borland {
15 
19 class NodeArray : public Node
20 {
21 public:
22  static std::shared_ptr<NodeArray> create();
23 
24  void addNode(std::shared_ptr<Node> node);
25 
26  bool empty() const;
27 
28  size_t size();
29 
30  void printLeft(std::ostream &s) const override;
31 
32  std::shared_ptr<Node> get(unsigned i) const; // TODO operator []
33 
34 protected:
35  NodeArray();
36 
37 protected:
38  std::vector<std::shared_ptr<Node>> _nodes;
39 };
40 
44 class NodeString : public NodeArray
45 {
46 public:
47  static std::shared_ptr<NodeString> create();
48 
49  void printLeft(std::ostream &s) const override;
50 
51 protected:
52  NodeString();
53 };
54 
55 } // borland
56 } // demangler
57 } // retdec
58 
59 #endif //RETDEC_NODE_ARRAY_H
Node for representation of arrays of nodes.
Definition: node_array.h:20
static std::shared_ptr< NodeArray > create()
Creates shared pointer to new NodeArray object.
Definition: node_array.cpp:24
bool empty() const
Definition: node_array.cpp:41
std::shared_ptr< Node > get(unsigned i) const
Definition: node_array.cpp:77
size_t size()
Definition: node_array.cpp:49
NodeArray()
Private constructor for NodeArray. Use create().
Definition: node_array.cpp:18
std::vector< std::shared_ptr< Node > > _nodes
Definition: node_array.h:38
void addNode(std::shared_ptr< Node > node)
Appends new node to array.
Definition: node_array.cpp:33
void printLeft(std::ostream &s) const override
Prints text representaion of array.
Definition: node_array.cpp:58
Node for representation of sequence of Nodes.
Definition: node_array.h:45
NodeString()
Definition: node_array.cpp:82
void printLeft(std::ostream &s) const override
Prints text representaion of array.
Definition: node_array.cpp:87
static std::shared_ptr< NodeString > create()
Definition: node_array.cpp:98
Base class for all nodes in AST.
Definition: node.h:22
Definition: archive_wrapper.h:19
Base class for all nodes in borland AST.