The program_option type is a wrapper that implements a useful subset of Boost's Program Options utility. More...
Public Member Functions | |
| bool | has_value () const | 
| Return whether the option was set.   | |
| operator ValueType () const | |
| Get the value, which must exist.   | |
| template<class F = decltype((default_check))> | |
| program_option (const char *name, const char *help, size_t count, F &&check=default_check) | |
| Construct a positional program option.   | |
| template<class F = decltype((default_check))> | |
| program_option (const char *section, const char *flag, const char *help, std::initializer_list< initializer_value > values={}, F &&check=default_check) | |
| Construct a program option.   | |
| ValueType | value () const | 
| Get the value, which must exist.   | |
The program_option type is a wrapper that implements a useful subset of Boost's Program Options utility.
Creating an instance of this type at namespace scope will add a program option that can be queried after the initialize function is called.
A validation function can have the signature bool(ValueType,std::stringstream&) or bool(flecsi::any,std::stringstream&). An error message may be written to the stream. In the latter, deprecated case, use option_value to obtain the ValueType. 
| program_option | ( | const char * | section, | 
| const char * | flag, | ||
| const char * | help, | ||
| std::initializer_list< initializer_value > | values = {}, | ||
| F && | check = default_check ) | 
Construct a program option.
| section | The options description label. | 
| flag | The command-line option in long, short, or dual form, e.g., "option,o" -> --option or -o. | 
| help | The help message for the option. | 
| values | Mechanism to set optional value attributes. Supported keys are option_default, option_implicit, option_zero, and option_multi. If an option_default value is specified, it will be used if the flag is not passed to the command line. If an option_implicit value is specified, it will be used if the flag is passed to the command line without a value. If option_zero is passed, the flag will not take any values, and must have an option_implicit value specified. If option_multi is passed, the flag will take multiple values. | 
| check | An optional, user-defined predicate to validate the option passed by the user; see signature below. | 
| program_option | ( | const char * | name, | 
| const char * | help, | ||
| size_t | count, | ||
| F && | check = default_check ) | 
Construct a positional program option.
| name | The name for the positional option. | 
| help | The help message for the option. | 
| count | The number of values to consume for this positional option. If -1 is passed, this option will consume all remaining values. | 
| check | An optional, user-defined predicate to validate the option passed by the user. | 
| ValueType value | ( | ) | const | 
Get the value, which must exist.
| operator ValueType | ( | ) | const | 
Get the value, which must exist.
| bool has_value | ( | ) | const | 
Return whether the option was set.