4.6.0
Freundlich's C++ toolkit
|
An option parser.
An option parser matches the next command-line parameter that follows after its short name ("-o") or its long name ("--option"), for example "--output log.txt". If there is no such pair of command-line parameters, then the option will use its default value if is has one. Otherwise, it will fail. The result of an option is a record that has a single element with label Label and type Type. In case reading the value into Type fails, the parser also fails.
Label | An fcppt::record::label. |
Type | The type of the flag's value. |
Public Types | |
using | optional_default_value = fcppt::options::default_value<fcppt::optional::object<Type>> |
using | element_type = fcppt::record::element<Label, Type> |
using | result_type = fcppt::record::object<element_type> |
Public Member Functions | |
option (fcppt::options::optional_short_name &&short_name, fcppt::options::long_name &&long_name, optional_default_value &&default_value, fcppt::options::optional_help_text &&help_text) | |
Constructs an option parser. | |
fcppt::options::parse_result< result_type > | parse (fcppt::options::state &&, fcppt::options::parse_context const &) const |
fcppt::options::flag_name_set | flag_names () const |
fcppt::options::option_name_set | option_names () const |
fcppt::options::usage | usage () const |
using fcppt::options::option< Label, Type >::element_type = fcppt::record::element<Label, Type> |
using fcppt::options::option< Label, Type >::optional_default_value = fcppt::options::default_value<fcppt::optional::object<Type>> |
using fcppt::options::option< Label, Type >::result_type = fcppt::record::object<element_type> |
fcppt::options::option< Label, Type >::option | ( | fcppt::options::optional_short_name && | short_name, |
fcppt::options::long_name && | long_name, | ||
optional_default_value && | default_value, | ||
fcppt::options::optional_help_text && | help_text ) |
Constructs an option parser.
short_name | An optional short name ("-o") this parser will match. |
long_name | The long name ("--option") this parser will match. |
default_value | An optional default value for this parser. |
help_text | Optional help text for this flag. |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscard |