![]() |
PIDUINO
|
Value option with implicit default value. More...
#include <popl.h>
Public Member Functions | |
Implicit (const std::string &short_name, const std::string &long_name, const std::string &description, const T &implicit_val, T *assign_to=nullptr) | |
Implicit implementation /////////////////////////////////. | |
Argument | argument_type () const override |
size_t | count () const override |
bool | is_set () const override |
void | assign_to (T *var) |
void | set_value (const T &value) |
T | value (size_t idx=0) const |
void | set_default (const T &value) |
bool | has_default () const |
T | get_default () const |
bool | get_default (std::ostream &out) const override |
char | short_name () const |
std::string | long_name () const |
std::string | name (OptionName what_name, bool with_hypen=false) const |
std::string | description () const |
void | set_attribute (const Attribute &attribute) |
Attribute | attribute () const |
Protected Member Functions | |
void | parse (OptionName what_name, const char *value) override |
virtual void | update_reference () |
virtual void | add_value (const T &value) |
void | clear () override |
Clear the internal data structure. | |
Protected Attributes | |
std::unique_ptr< T > | default_ |
T * | assign_to_ |
std::vector< T > | values_ |
std::string | short_name_ |
std::string | long_name_ |
std::string | description_ |
Attribute | attribute_ |
Value option with implicit default value.
Value option with implicit default value If set, an argument is optional -without argument it carries the implicit default value -with argument it carries the explicit value
|
inline |
|
inlineprotectedvirtualinherited |
|
inlineoverridevirtual |
Get the Option's argument type
Implements Piduino::Option.
Definition at line 743 of file popl.h.
References Piduino::optional.
|
inlineinherited |
Assign the last parsed command line value to "var"
var | pointer to the variable where is value is written to |
Definition at line 579 of file popl.h.
Referenced by Piduino::Value< T >::Value().
|
inlineinherited |
Get the Option's attribute
Definition at line 542 of file popl.h.
References Piduino::Option::attribute_.
Referenced by Piduino::Option::set_attribute().
|
inlineoverrideprotectedvirtualinherited |
Clear the internal data structure.
Implements Piduino::Option.
|
inlineoverridevirtualinherited |
Check how often the Option is set on command line
Implements Piduino::Option.
|
inlineinherited |
Get the Option's description
Definition at line 532 of file popl.h.
References Piduino::Option::description_.
|
inlineinherited |
|
inlineoverridevirtualinherited |
Get the Option's default value
out | stream to write the default value to |
Implements Piduino::Option.
|
inlineinherited |
|
inlineoverridevirtualinherited |
|
inlineinherited |
Get the Option's long name
Definition at line 516 of file popl.h.
References Piduino::Option::long_name_.
Referenced by Piduino::Option::Option().
|
inlineinherited |
Get the Option's long or short name
what_name | the option's name to return |
what_hyphen | preced the returned name with (double-)hypen |
Definition at line 521 of file popl.h.
References Piduino::long_name, Piduino::Option::long_name_, Piduino::short_name, and Piduino::Option::short_name_.
|
inlineoverrideprotectedvirtual |
Parse the command line option and fill the internal data structure
what_name | short or long option name |
value | the value as given on command line |
Implements Piduino::Option.
Definition at line 749 of file popl.h.
References Piduino::Value< T >::parse().
|
inlineinherited |
Set the Option's attribute
attribute |
Definition at line 537 of file popl.h.
References Piduino::Option::attribute(), and Piduino::Option::attribute_.
|
inlineinherited |
Set the Option's default value
value | the default value if not specified on command line |
Definition at line 624 of file popl.h.
Referenced by Piduino::Value< T >::Value().
|
inlineinherited |
|
inlineinherited |
Get the Option's short name
Definition at line 508 of file popl.h.
References Piduino::Option::short_name_.
Referenced by Piduino::Option::Option().
|
inlineprotectedvirtualinherited |
|
inlineinherited |
Get the Option's value. Will throw if option at index idx is not available
idx | the zero based index of the value (if set multiple times) |
Definition at line 593 of file popl.h.
References Piduino::long_name, and Piduino::short_name.
|
protectedinherited |
Definition at line 236 of file popl.h.
Referenced by Piduino::Value< T >::Value().
|
protectedinherited |
Definition at line 169 of file popl.h.
Referenced by Piduino::Option::attribute(), and Piduino::Option::set_attribute().
|
protectedinherited |
|
protectedinherited |
Definition at line 168 of file popl.h.
Referenced by Piduino::Option::description().
|
protectedinherited |
Definition at line 167 of file popl.h.
Referenced by Piduino::Option::long_name(), and Piduino::Option::name().
|
protectedinherited |
Definition at line 166 of file popl.h.
Referenced by Piduino::Option::name(), and Piduino::Option::short_name().
|
protectedinherited |