From 20a2aa6070d6e7e6a1bd9e0bb2e85eca10543bbc Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 9 May 2024 11:53:46 +0200 Subject: Added programopts --- programopts.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 programopts.h (limited to 'programopts.h') diff --git a/programopts.h b/programopts.h new file mode 100644 index 0000000..442d3b0 --- /dev/null +++ b/programopts.h @@ -0,0 +1,29 @@ +// Parse command line options of program + +#pragma once + +#include +#include +#include +#include +#include + +#define EXPORT __attribute__((visibility("default"))) + +namespace Reichwein { + +class EXPORT 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; +}; + +} // namespace -- cgit v1.2.3