-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharg_parser.cpp
More file actions
53 lines (45 loc) · 1.38 KB
/
Copy patharg_parser.cpp
File metadata and controls
53 lines (45 loc) · 1.38 KB
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
#include "arg_parser.h"
#include "filters/crop.h"
#include "filters/grayscale.h"
#include "filters/negative.h"
#include "filters/sharpening.h"
#include "filters/edge_detection.h"
Parse::Parse(int argc, char** argv) {
if (argc == 0) {
return;
}
std::vector<std::string> args(argv, argv + argc);
from_ = args[1];
to_ = args[2];
for (int i = 3; i < argc; ++i) {
if (args[i] == "-crop") {
commands_.push_back("-crop");
commands_.push_back(args[++i]);
commands_.push_back(args[++i]);
} else if (args[i] == "-gs") {
commands_.push_back("-gs");
} else if (args[i] == "-neg") {
commands_.push_back("-neg");
} else if (args[i] == "-sharp") {
commands_.push_back("-sharp");
} else if (args[i] == "-edge") {
commands_.push_back("-edge");
commands_.push_back(args[++i]);
} else if (args[i] == "-blur") {
commands_.push_back("-blur");
commands_.push_back(args[++i]);
} else if (args[i] == "-crystallize") {
commands_.push_back("-crystallize");
commands_.push_back(args[++i]);
}
}
}
std::vector<std::string> Parse::GetCommands() const {
return commands_;
}
std::string Parse::GetFrom() const {
return from_;
}
std::string Parse::GetTo() const {
return to_;
}