Compute Library
18.05
|
Implementation of an option that can be either true or false. More...
#include <ToggleOption.h>
Public Member Functions | |
ToggleOption (std::string name, bool default_value) | |
Construct the option with the given default value. More... | |
bool | parse (std::string value) override |
Parses the given string. More... | |
std::string | help () const override |
Help message for the option. More... | |
![]() | |
SimpleOption (std::string name, booldefault_value) | |
Construct the option with the given default value. More... | |
bool | parse (std::string value) override |
Parses the given string. More... | |
std::string | help () const override |
Help message for the option. More... | |
const bool & | value () const |
Get the option value. More... | |
![]() | |
Option (std::string name) | |
Constructor. More... | |
Option (std::string name, bool is_required, bool is_set) | |
Constructor. More... | |
virtual | ~Option ()=default |
Default destructor. More... | |
std::string | name () const |
Name of the option. More... | |
void | set_required (bool is_required) |
Set whether the option is required. More... | |
void | set_help (std::string help) |
Set the help message for the option. More... | |
bool | is_required () const |
Is the option required? More... | |
bool | is_set () const |
Has a value been assigned to the option? More... | |
Implementation of an option that can be either true or false.
Definition at line 38 of file ToggleOption.h.
ToggleOption | ( | std::string | name, |
bool | default_value | ||
) |
Construct the option with the given default value.
[in] | name | Name of the option. |
[in] | default_value | Default value. |
Definition at line 34 of file ToggleOption.cpp.
References ToggleOption::help(), Option::name(), ToggleOption::parse(), and SimpleOption< bool >::value().
|
overridevirtual |
Help message for the option.
Implements Option.
Referenced by ToggleOption::ToggleOption().
|
overridevirtual |
Parses the given string.
[in] | value | String representation as passed on the command line. |
Implements Option.
Referenced by ToggleOption::ToggleOption().