-
Notifications
You must be signed in to change notification settings - Fork 0
/
argparser.h
48 lines (35 loc) · 1002 Bytes
/
argparser.h
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
//
// Created by Artur Laskowski on 10/11/2017.
//
#ifndef __ARGPARSER_H
#define __ARGPARSER_H
#include <vector>
#include <iostream>
#include <string>
#include <unordered_map>
#include <cmath>
#include <tuple>
namespace argparser {
struct __type {
std::string short_name;
std::string long_name;
std::string description;
bool binary;
__type(std::string s, std::string l, std::string d, bool b=false)
: short_name(s), long_name(l), description(d), binary(b) {}
};
class argparser {
private:
std::vector<__type> args_types;
public:
argparser();
virtual ~argparser();
bool parse_args(int, char *[]);
std::unordered_map<std::string, std::string> args;
void show_usage(std::string);
void addArgHandler(__type);
bool exists(std::string);
std::string handle_argument(std::string argument, std::string default_value="");
};
}
#endif //__ARGPARSER_H