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.
 

Data Fields

std::string name
 Variable name (option name for scalar options, schema key name for structured options).
 
std::string value
 Default value as a string (or goptions::NODFLT : to mark as mandatory).
 
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).

Values are stored internally as strings for uniform YAML construction and printing.

Definition at line 33 of file goption.h.

Constructor & Destructor Documentation

◆ GVariable() [1/5]

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

Definition at line 45 of file goption.h.

◆ GVariable() [2/5]

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

Definition at line 55 of file goption.h.

◆ GVariable() [3/5]

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 64 of file goption.h.

◆ GVariable() [4/5]

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

Definition at line 74 of file goption.h.

◆ GVariable() [5/5]

GVariable::GVariable ( std::string n,
bool val,
std::string d )
inline
Parameters
nName of the variable.
valDefault value (bool), stored as "true" or "false".
dDescription displayed in help.

Definition at line 83 of file goption.h.

Field Documentation

◆ description

std::string GVariable::description

Definition at line 37 of file goption.h.

◆ name

std::string GVariable::name

Definition at line 35 of file goption.h.

◆ value

std::string GVariable::value

Definition at line 36 of file goption.h.


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