#pragma once #include #include #include #include #include namespace dg { using Handle = std::function; class Options { public: Options(); /// @param name name of the option /// @param has_arg kind of arguments that are used (no_argument, required_argument, optional_argument) /// @param val identifies the option (see getopt documentation) /// @param handle lambda that is invoked when the option occures void add(std::string const & name, int has_arg, int val, Handle handle); /// @param name name of the option /// @param has_arg kind of arguments that are used (no_argument, required_argument, optional_argument) /// @param flag optional pointer that is set after the option occured /// @param val value for the flag to be set /// @param handle lambda that is invoked when the option occures 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