-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariable.hpp
More file actions
executable file
·53 lines (38 loc) · 922 Bytes
/
Variable.hpp
File metadata and controls
executable file
·53 lines (38 loc) · 922 Bytes
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
#ifndef _VARIABLE_HPP
#define _VARIABLE_HPP
#include "Types.hpp"
#include <iostream>
class Variable {
private:
void* value = nullptr;
int scope;
void deleteValue();
static const std::regex variableRegex;
protected:
Types::TypeName type;
public:
Variable(void* v, Types::TypeName t, int s);
Variable(Variable* var);
~Variable();
void* getValue() {
return value;
}
void setValue(void* v) {
deleteValue();
value = v;
}
Types::TypeName getType() {
return type;
}
virtual void setType(Types::TypeName t);
static bool isVariable(std::string& s) {
if(s.compare("AND")==0 || s.compare("OR")==0 || s.compare("NOT")==0) return false;
return std::regex_match(s, variableRegex);
}
int getScope() {
return scope;
}
void printDetails();
virtual void print();
};
#endif //_VARIABLE_HPP