-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparsing_process.cpp
63 lines (52 loc) · 1.53 KB
/
parsing_process.cpp
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
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include <api.hpp>
#include <io.hpp>
#include <boost/program_options.hpp>
class call {
public:
call() { }
template <typename Index>
void invoke(Index &idx)
{
auto parsing = idx.get_parsing();
for (auto &i : parsing) {
std::int64_t offset;
size_t copy_len;
size_t junk_len;
std::tie(offset, copy_len, junk_len) = i;
std::cout << offset << "\t" << copy_len << "\t" << junk_len << std::endl;
}
}
};
int main(int argc, char **argv)
{
using std::string;
namespace po = boost::program_options;
po::options_description desc;
po::variables_map vm;
try {
desc.add_options()
("index-file,i", po::value<string>()->required(),
"Index filename.")
("reference-file,r", po::value<string>()->required(),
"Reference filename");
po::positional_options_description pd;
pd.add("index-file", 1).add("reference-file", 1);
try {
po::store(po::command_line_parser(argc, argv).options(desc).positional(pd).run(), vm);
po::notify(vm);
} catch (boost::program_options::error &e) {
throw std::runtime_error(e.what());
}
string index = vm["index-file"].as<string>();
string reference = vm["reference-file"].as<string>();
call c;
rlz::serialize::load_stream(index.c_str(), reference.c_str(), c);
} catch (std::exception &e) {
std::cerr << e.what() << "\n"
<< "Command-line options:" << "\n"
<< desc << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}