-
Notifications
You must be signed in to change notification settings - Fork 0
/
munode.h
66 lines (52 loc) · 1.65 KB
/
munode.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
#ifndef MUNODE_H
#define MUNODE_H
#include <iostream>
#include "muParser.h"
// A class to parse & execute text files, muNode is best used as program interpreter.
class muNode
{
public:
muNode(muNode* parent = nullptr) : parent(parent) {
if (parent) {
parent->addChild(this);
}
}
muNode* parent;
std::vector<muNode*> children;
std::string expression;
std::string condition;
std::string name;
std::string text;
std::string filenode;
bool condition_result=1;
std::string text_result;
int nr=0;
bool execute_step_by_step=0;
void addChild(muNode* child);
double evaluateExpression(mu::Parser &parser);
bool evaluateCondition(mu::Parser &parser);
void addVar(std::string name, double &value, mu::Parser& parser);
void setDebug(bool name,
bool condition, bool condition_result,
bool expression,
bool variables,
bool text);
void printVars(int depth, mu::Parser& parser);
std::string getNodeCommand(const mu::Parser &parser);
void printNode(const mu::Parser &parser);
bool hasParent() const; // Returns 1 if parent excists.
bool hasChild() const ;
bool hasLowerSibling() const ;
bool hasUpperSibling() const ;
muNode* getTopNode();
muNode* getLowerSibling();
muNode* getUpperSibling();
bool isValid(muNode *node); // Declaration of isValid function
void printhierarchy(int depth = 0);
bool waitForEnterInput();
muNode* getNextNode();
muNode* getNextNodeByCondition(mu::Parser &parser);
muNode* getPreviousNode();
private:
};
#endif // MUNODE_H