-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset.cpp
More file actions
41 lines (32 loc) · 655 Bytes
/
Copy pathset.cpp
File metadata and controls
41 lines (32 loc) · 655 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
#include <string>
#include "set.h"
Set::Set(string str)
:Section(str)
{
string val;
int pos = str.find("$");
for(int i = pos + 1; str[i] != ' '; i++)
varname += str[i];
pos = str.find("to ");
for(int i = pos + 3; i < str.size()-1;i++)
val += str[i];
if(val == "true")
value = true;
else
value = false;
}
void Set::execute(Interpreter* ins)
{
if(ins->vars.find(varname) == ins->vars.end())
ins->vars.emplace(varname,value);
else
ins->vars[varname] = value;
}
string Set::getVar()
{
return varname;
}
bool Set::getVal()
{
return value;
}