-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·45 lines (43 loc) · 1.36 KB
/
main.cpp
File metadata and controls
executable file
·45 lines (43 loc) · 1.36 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
#include "file.hpp"
#include "Integers.hpp"
#include "ProgramOptions/builder.hpp"
int main(int argc, char** argv)
{
ProgramOptions::Builder bldr;
string path = "", path_to_txt = "";
bool list_flag = false, allow_bits = false;
long long value = 0;
bldr
.addParam(path, 'f', "FilePath", "File Path to find integers")
.addFlag(allow_bits, 'b', "bits", "Allow bit fields find")
.addFlag(list_flag, 'l', "List", "List of finded integers")
.addOption(value, 'i', "Int","Int to find")
.addOption(path_to_txt, 't', "Txt", "Txt file to find intersection with integers from bin file")
.setVersion("v1.1")
.parse(argc, argv);
auto res = ReadAll(path.c_str());
if (list_flag)
{
Integers integers;
integers.parse(res.begin().base(), res.end().base(), allow_bits);
integers.print();
integers.to_le();
cout << "\n------Swap-----\n";
integers.print();
}
if (value)
{
find(res.begin().base(), res.end().base(), value);
}
if (path_to_txt != "")
{
string str = ReadAllText(path_to_txt.c_str());
Integers integers;
integers.parse(res.begin().base(), res.end().base(), allow_bits);
integers.filter(str).print();
cout << "\n------Swap-----\n";
integers.to_le();
integers.filter(str).print();
}
return 0;
}