From ce77838c4f32b9dc237f0c4b17d1f1e1741254d4 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 26 Oct 2020 15:38:54 +0100 Subject: Added ProgramOpts --- programopts.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 programopts.h (limited to 'programopts.h') diff --git a/programopts.h b/programopts.h new file mode 100644 index 0000000..af706f7 --- /dev/null +++ b/programopts.h @@ -0,0 +1,24 @@ +// Parse command line options of program + +#pragma once + +#include +#include +#include +#include +#include + +class ProgramOpts +{ +public: + // Processing of options in lambdas: each do return true iff parameter was consumed + ProgramOpts(int argc, char* argv[], std::map>& option_prefixes); + ~ProgramOpts(); + void process(); // must be called to run functions per option, given to ctor + std::string programName(); + std::vector nonOptionArguments(); +private: + struct impl; + std::unique_ptr m_pimpl; +}; + -- cgit v1.2.3