Represents a configurable option with a name, value(s), description, and help text.
More...
#include <goption.h>
|
| GOption (GVariable dv, std::string h) |
| Constructor for a scalar option with a default value. More...
|
|
| GOption (std::string n, std::string desc, std::vector< GVariable > dv, std::string h) |
| Constructor for a sequence option. More...
|
|
void | set_sub_option_value (const std::string &subkey, const std::string &subvalue) |
| Sets the value of a sub–option using dot–notation. More...
|
|
The GOption class is used to define options from a YAML configuration node. Options can be scalar or sequences, and they can have default values or be cumulative. This class encapsulates the logic to set values from YAML nodes and command-line arguments.
Definition at line 85 of file goption.h.
◆ GOption() [1/2]
GOption::GOption |
( |
GVariable |
dv, |
|
|
std::string |
h |
|
) |
| |
|
inline |
- Parameters
-
dv | A GVariable containing the name, default value, and description of the option. |
h | Help text for the option. |
Definition at line 92 of file goption.h.
◆ GOption() [2/2]
GOption::GOption |
( |
std::string |
n, |
|
|
std::string |
desc, |
|
|
std::vector< GVariable > |
dv, |
|
|
std::string |
h |
|
) |
| |
|
inline |
- Parameters
-
n | Name of the option. |
desc | Summary description of the option. |
dv | Vector of GVariable objects representing each element's default value and description. |
h | Help text for the option. |
Definition at line 104 of file goption.h.
◆ set_sub_option_value()
void GOption::set_sub_option_value |
( |
const std::string & |
subkey, |
|
|
const std::string & |
subvalue |
|
) |
| |
For example, a command-line argument like "-verbosity.general=2" will update the sub–option identified by "general" within the "verbosity" option.
- Parameters
-
subkey | The sub–option key to update. |
subvalue | The new value for the sub–option, given as a string. |
For options that are structured as maps or sequences of maps, this function updates a single sub–option (e.g. for "-debug.general=true", it updates the "general" key within "debug").
- Parameters
-
subkey | The key within the option to update. |
subvalue | The new value for the sub–option as a string. |
Definition at line 229 of file goption.cc.
The documentation for this class was generated from the following files: