Compute Library
18.05
|
Abstract base class for a command line option. More...
#include <Option.h>
Public Member Functions | |
Option (std::string name) | |
Constructor. More... | |
Option (std::string name, bool is_required, bool is_set) | |
Constructor. More... | |
virtual | ~Option ()=default |
Default destructor. More... | |
virtual bool | parse (std::string value)=0 |
Parses the given string. More... | |
virtual std::string | help () const =0 |
Help message for the option. 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... | |
Option | ( | std::string | name | ) |
Constructor.
[in] | name | Name of the option. |
Definition at line 32 of file Option.cpp.
Option | ( | std::string | name, |
bool | is_required, | ||
bool | is_set | ||
) |
Constructor.
[in] | name | Name of the option. |
[in] | is_required | Is the option required? |
[in] | is_set | Has a value been assigned to the option? |
Definition at line 37 of file Option.cpp.
References Option::is_required(), and Option::is_set().
|
virtualdefault |
Default destructor.
|
pure virtual |
Help message for the option.
Implemented in SimpleOption< T >, SimpleOption< LogFormat >, SimpleOption< std::string >, SimpleOption< int >, SimpleOption< LogLevel >, SimpleOption< bool >, EnumListOption< T >, EnumListOption< InstrumentsDescription >, EnumOption< T >, EnumOption< LogFormat >, EnumOption< LogLevel >, ListOption< T >, and ToggleOption.
bool is_required | ( | ) | const |
Is the option required?
Definition at line 57 of file Option.cpp.
Referenced by Option::Option(), and Option::set_required().
bool is_set | ( | ) | const |
Has a value been assigned to the option?
Definition at line 62 of file Option.cpp.
Referenced by CommonOptions::create_printers(), main(), and Option::Option().
std::string name | ( | ) | const |
Name of the option.
Definition at line 42 of file Option.cpp.
Referenced by ListOption< T >::help(), EnumListOption< T >::help(), SimpleOption< T >::help(), and ToggleOption::ToggleOption().
|
pure virtual |
Parses the given string.
[in] | value | String representation as passed on the command line. |
Implemented in SimpleOption< T >, EnumListOption< T >, EnumListOption< InstrumentsDescription >, EnumOption< T >, EnumOption< LogFormat >, EnumOption< LogLevel >, SimpleOption< T >, SimpleOption< LogFormat >, SimpleOption< std::string >, SimpleOption< int >, SimpleOption< LogLevel >, SimpleOption< bool >, ListOption< T >, and ToggleOption.
void set_help | ( | std::string | help | ) |
Set the help message for the option.
[in] | help | Option specific help message. |
Definition at line 52 of file Option.cpp.
Referenced by CommonOptions::CommonOptions(), and main().
void set_required | ( | bool | is_required | ) |
Set whether the option is required.
[in] | is_required | Pass true if the option is required. |
Definition at line 47 of file Option.cpp.
References Option::is_required().