goptions
Loading...
Searching...
No Matches
GVariable Struct Reference

Describes a schema entry: key name, default value, and user-facing description. More...

#include <goption.h>

Public Member Functions

 GVariable (std::string n, std::string val, std::string d)
 Constructor for initializing a variable with a string default.
 GVariable (std::string n, double val, std::string d)
 Constructor for initializing a variable with a double default.
 GVariable (std::string n, const char *val, std::string d)
 Constructor for initializing a variable with a C-string default.
 GVariable (std::string n, int val, std::string d)
 Constructor for initializing a variable with an integer default.
 GVariable (std::string n, bool val, std::string d)
 Constructor for initializing a variable with a boolean default.
 GVariable (std::string n, std::nullopt_t, std::string d)
 GVariable (std::string n, goptions::RequiredValue, std::string d)

Data Fields

std::string name
 Variable name (option name for scalar options, schema key name for structured options).
YAML::Node defaultValue
 Typed default; null for optional-null and required fields.
bool required {}
 Whether a structured field must be supplied by the user.
std::string description
 Human-readable description used in help output.

Detailed Description

GVariable : is primarily used when defining options:

  • Scalar option: one GVariable : holds option name, default value, and summary description.
  • Structured option: a vector of GVariable : entries defines the schema (keys and defaults).

Defaults are stored as typed YAML nodes, while required fields are represented explicitly.

Definition at line 34 of file goption.h.

Constructor & Destructor Documentation

◆ GVariable() [1/7]

GVariable::GVariable ( std::string n,
std::string val,
std::string d )
inline
Parameters
nName of the variable.
valDefault string value.
dDescription displayed in help.

Definition at line 47 of file goption.h.

◆ GVariable() [2/7]

GVariable::GVariable ( std::string n,
double val,
std::string d )
inline
Parameters
nName of the variable.
valTyped double default.
dDescription displayed in help.

Definition at line 57 of file goption.h.

◆ GVariable() [3/7]

GVariable::GVariable ( std::string n,
const char * val,
std::string d )
inline
Parameters
nName of the variable.
valDefault value (C-string).
dDescription displayed in help.

Definition at line 67 of file goption.h.

◆ GVariable() [4/7]

GVariable::GVariable ( std::string n,
int val,
std::string d )
inline
Parameters
nName of the variable.
valTyped integer default.
dDescription displayed in help.

Definition at line 77 of file goption.h.

◆ GVariable() [5/7]

GVariable::GVariable ( std::string n,
bool val,
std::string d )
inline
Parameters
nName of the variable.
valTyped boolean default.
dDescription displayed in help.

Definition at line 87 of file goption.h.

◆ GVariable() [6/7]

GVariable::GVariable ( std::string n,
std::nullopt_t ,
std::string d )
inline

Construct an option or field whose default is YAML null.

Definition at line 92 of file goption.h.

◆ GVariable() [7/7]

GVariable::GVariable ( std::string n,
goptions::RequiredValue ,
std::string d )
inline

Construct a mandatory structured field.

Definition at line 97 of file goption.h.

Field Documentation

◆ defaultValue

YAML::Node GVariable::defaultValue

Definition at line 37 of file goption.h.

◆ description

std::string GVariable::description

Definition at line 39 of file goption.h.

◆ name

std::string GVariable::name

Definition at line 36 of file goption.h.

◆ required

bool GVariable::required {}

Definition at line 38 of file goption.h.


The documentation for this struct was generated from the following file: