-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparsing.cpp
More file actions
27 lines (23 loc) · 776 Bytes
/
parsing.cpp
File metadata and controls
27 lines (23 loc) · 776 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
#include "parsing.h"
Parsing::Parsing(int argc, char** argv) {
if (argc < 3) {
throw std::runtime_error("not enough arguments or incorrect input");
}
input_file = argv[1];
if (std::string(input_file).empty() || input_file[0] == '-') {
throw std::runtime_error("not enough arguments or incorrect input");
}
output_file = argv[2];
if (std::string(output_file).empty() || output_file[0] == '-') {
throw std::runtime_error("not enough arguments or incorrect input");
}
std::string filter;
for (int i = 3; i < argc; ++i) {
if (argv[i][0] == '-') {
filter = std::string(argv[i]);
args[filter] = {};
} else {
args[filter].emplace_back(argv[i]);
}
}
}