blob: af706f7e580a4860f4f089d93de05ca1882bbbc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// Parse command line options of program
#pragma once
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
class ProgramOpts
{
public:
// Processing of options in lambdas: each do return true iff parameter was consumed
ProgramOpts(int argc, char* argv[], std::map<std::string, std::function<bool(const std::string&)>>& option_prefixes);
~ProgramOpts();
void process(); // must be called to run functions per option, given to ctor
std::string programName();
std::vector<std::string> nonOptionArguments();
private:
struct impl;
std::unique_ptr<impl> m_pimpl;
};
|