-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cc
51 lines (50 loc) · 1.14 KB
/
main.cc
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
#include "controller.h"
#include "tag.h"
#include <iostream>
#include <string>
using namespace std;
int main() {
Controller ctr;
string cmd;
string option;
cout << "[Command?]" << endl;
while (cin >> cmd) {
if (cmd == "print") {
ctr.print();
} else if (cmd == "add") {
cin >> option;
ctr.addChild(option);
} else if (cmd == "delete") {
ctr.deleteCur();
} else if (cmd == "parent") {
ctr.parent();
} else if (cmd == "up") {
ctr.up();
} else if (cmd == "id") {
cin >> option;
ctr.setId(option);
} else if (cmd == "value") {
cin >> option;
ctr.setValue(option);
} else if (cmd == "find") {
cin >> option;
ctr.findChild(option);
} else if (cmd == "findId") {
cin >> option;
ctr.findChildId(option);
} else if (cmd == "list") {
ctr.list();
} else if (cmd == "cut") {
ctr.cut();
} else if (cmd == "copy") {
ctr.copy();
} else if (cmd == "paste") {
ctr.paste();
} else if (cmd == "quit") {
break;
} else {
cerr << "Invalid command." << endl;
}
cout << "[Command?]" << endl;
}
}