From 940e1b410343f423a9bc41ca8da0c3859e2333fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Gl=C3=B6ckner?= Date: Tue, 29 Mar 2016 08:30:06 +0200 Subject: Initial implementation --- getoptpp.hpp | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 getoptpp.hpp (limited to 'getoptpp.hpp') diff --git a/getoptpp.hpp b/getoptpp.hpp new file mode 100644 index 0000000..4fe3c3a --- /dev/null +++ b/getoptpp.hpp @@ -0,0 +1,96 @@ +#pragma once +#include +#include +#include +#include +#include + +namespace gopt { + +using Handle = std::function; + +class Options { + public: + Options(); + + void add(std::string const & name, int has_arg, int val, Handle handle); + void add(std::string const & name, int has_arg, int* flag, int val, Handle handle); + + void process(int argc, char* argv[]); + + private: + std::size_t num_flags; + std::vector