-
Notifications
You must be signed in to change notification settings - Fork 0
/
OMDNode.h
103 lines (76 loc) · 2.25 KB
/
OMDNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef _OMDNode_h
#define _OMDNode_h
#include <string>
#include <vector>
#include <sstream>
#include "OMDBase.h"
//
// The data model for the OMD data structure "scaffold" is the node:
// the node can have a parent (except the root node), and
// children; each node has a type (for simplicity, the yytokentype
// is used to identify the node from the parsing processing).
//
// Because of the ubiquity of the notes in the OMD file,
// the note reference is stored in the OMDBase class.
//
//
class OMDNode : public OMDBase
{
public:
OMDNode(OMDBase::NodeTypeEnum, const Loc * pLoc = NULL);
virtual ~OMDNode();
//
// Get a string value of this node. This is performed recursively.
//
const std::string getString(void) const;
// virtual
// bool operator==(const OMDBase & rhs) const;
// virtual
// bool operator!=(const OMDBase & rhs) const;
virtual
bool equalSameOrder(const OMDBase & rhs) const;
virtual
bool equalAnyOrder(const OMDBase & rhs) const;
virtual
bool equal(const OMDBase & rhs) const;
virtual
bool notEqual(const OMDBase & rhs) const;
//
// Get a child based on the index. NULL is returned
// if the index is out of range.
//
OMDBase * getChild(size_t index) const;
//
// Get the child with attribute kind (such as DataType)
// returns the OMDBase pointer to the object or NULL
// if not found.
//
OMDBase * getChild(const std::string & kind);
const OMDBase * getChild(const std::string & kind) const;
OMDBase * getChild(OMDBase::NodeTypeEnum kind);
//
// Get the count of the children
//
size_t getChildCount(void) const;
//
// Add a child to the list of children
//
void addChild(OMDBase * pChild);
void Add(OMDBase * pChild);
//
// This returns "OMDNode" but could do more (be virtual?)
//
const char * getType(void) const;
//
// This method supports the visitor design pattern
//
virtual void Execute(OMDTask * pTask) const;
const std::vector<OMDBase *> & getChildren() const;
std::ostream & print(std::ostream & out) const;
protected:
std::vector<OMDBase *> m_Children;
};
#endif
// Local Variables:
// mode:C++
// End: