![]() |
PIDUINO
|
Abstract Base class for Options. More...
#include <popl.h>
Public Member Functions | |
| Option (const std::string &short_name, const std::string &long_name, std::string description) | |
| Option implementation /////////////////////////////////. | |
| virtual | ~Option ()=default |
| Destructor. | |
| Option (const Option &)=default | |
| default copy constructor | |
| Option (Option &&)=default | |
| default move constructor | |
| Option & | operator= (const Option &)=default |
| default assignement operator | |
| Option & | operator= (Option &&)=default |
| default move assignement operator | |
| char | short_name () const |
| std::string | long_name () const |
| std::string | name (OptionName what_name, bool with_hypen=false) const |
| std::string | description () const |
| virtual bool | get_default (std::ostream &out) const =0 |
| void | set_attribute (const Attribute &attribute) |
| Attribute | attribute () const |
| virtual Argument | argument_type () const =0 |
| virtual size_t | count () const =0 |
| virtual bool | is_set () const =0 |
Protected Member Functions | |
| virtual void | parse (OptionName what_name, const char *value)=0 |
| virtual void | clear ()=0 |
| Clear the internal data structure. | |
Protected Attributes | |
| std::string | short_name_ |
| std::string | long_name_ |
| std::string | description_ |
| Attribute | attribute_ |
Abstract Base class for Options.
Base class for Options holds just configuration data, no runtime data. Option is not bound to a special type "T"
|
inline |
Option implementation /////////////////////////////////.
Construct an Option
| short_name | the options's short name. Must be empty or one character. |
| long_name | the option's long name. Can be empty. |
| description | the Option's description that will be shown in the help message |
Definition at line 493 of file popl.h.
References long_name(), and short_name().
|
virtualdefault |
Destructor.
|
default |
default copy constructor
|
default |
default move constructor
|
pure virtual |
Get the Option's argument type
Implemented in Piduino::Value< T >, Piduino::Value< bool >, Piduino::Implicit< T >, and Piduino::Switch.
|
inline |
Get the Option's attribute
Definition at line 542 of file popl.h.
References attribute_.
Referenced by set_attribute().
|
protectedpure virtual |
Clear the internal data structure.
Implemented in Piduino::Value< T >, and Piduino::Value< bool >.
|
pure virtual |
Check how often the Option is set on command line
Implemented in Piduino::Value< T >, and Piduino::Value< bool >.
|
inline |
Get the Option's description
Definition at line 532 of file popl.h.
References description_.
|
pure virtual |
Get the Option's default value
| out | stream to write the default value to |
Implemented in Piduino::Value< T >, and Piduino::Value< bool >.
|
pure virtual |
Check if the Option is set
Implemented in Piduino::Value< T >, and Piduino::Value< bool >.
|
inline |
|
inline |
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, long_name_, Piduino::short_name, and short_name_.
|
protectedpure virtual |
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 |
Implemented in Piduino::Value< T >, Piduino::Value< bool >, Piduino::Value< T >, Piduino::Value< bool >, Piduino::Implicit< T >, and Piduino::Switch.
|
inline |
Set the Option's attribute
| attribute |
Definition at line 537 of file popl.h.
References attribute(), and attribute_.
|
inline |
Get the Option's short name
Definition at line 508 of file popl.h.
References short_name_.
Referenced by Option().
|
protected |
Definition at line 169 of file popl.h.
Referenced by attribute(), and set_attribute().
|
protected |
Definition at line 168 of file popl.h.
Referenced by description().
|
protected |
Definition at line 167 of file popl.h.
Referenced by long_name(), and name().
|
protected |
Definition at line 166 of file popl.h.
Referenced by name(), and short_name().