-
Notifications
You must be signed in to change notification settings - Fork 87
Module: Argument Parser
Hannes Hauswedell edited this page Jan 23, 2017
·
19 revisions
Links:
- Boost: http://www.boost.org/doc/libs/1_58_0/doc/html/program_options.html
- follow POSIX guidelines: http://bioportal.weizmann.ac.il/course/prog2/tutorial/essential/attributes/_posix.html
Possible interface:
addOption(char const shortID, // -o
std::string const & longID, // --output
TValue & savePlace, // myOptions.outputFile (std::string)
std::function<bool(TValue const&)> && validator = [] (TValue const&) { return true; } );savePlace would be an existing variable that also defines the type of the argument. savePlace can be set to a default value upon definition/creation / outside of the addArgument function.
validator is a callable that verifies the argument. It can be user-specified, but there shall be pre-defined validators for integral ranges (takes a pair of integral) or file extensions (takes a container of std::string).