-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathprogramOptions.hpp
More file actions
44 lines (34 loc) · 911 Bytes
/
programOptions.hpp
File metadata and controls
44 lines (34 loc) · 911 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* programOptions.hpp
*
* Created on: Aug 12, 2015
* Author: Roman Savrulin <romeo.deepmind@gmail.com>
*/
#ifndef INCLUDE_FLEXIBITY_PROGRAMOPTIONS_HPP_
#define INCLUDE_FLEXIBITY_PROGRAMOPTIONS_HPP_
#include "flexibity/log.h"
#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>
namespace Flexibity {
namespace po = boost::program_options;
class programOptions{
public:
programOptions():desc("General options"){
desc.add_options()("help,h", "Show help");
}
virtual ~programOptions(){}
virtual void parse(int ac, char** av) {
po::parsed_options parsed =
po::command_line_parser(ac, av).options(desc).allow_unregistered().run();
po::store(parsed, vm);
po::notify(vm);
if (vm.count("help")) {
std::cout << desc << "\n";
exit(1);
}
}
po::options_description desc;
po::variables_map vm;
};
}
#endif /* INCLUDE_FLEXIBITY_PROGRAMOPTIONS_HPP_ */