|
goptions
|
Represents a boolean command-line switch with a description and a status. More...
#include <gswitch.h>
Public Member Functions | |
| GSwitch ()=default | |
| Default constructor. | |
| GSwitch (const std::string &d, bool default_status=false) | |
| Parameterized constructor. | |
| void | turnOn () |
| Turns the switch on. | |
| void | turnOff () |
| Turns the switch off. | |
| bool | getStatus () const |
| Retrieves the current status of the switch. | |
| const std::string & | getDescription () const |
| Retrieves the description of the switch. | |
A switch is a presence-based boolean flag:
-gui), it becomes on (true).Switches are stored by GOptions : and are typically used for enabling/disabling optional behaviors in an application (GUI, interactive mode, logging toggles, etc.).
Design intent:
|
default |
|
inline |
Initializes the switch description and its default status. The status defaults to false (off) so that defining a switch never enables it implicitly; pass true to define a switch that is on by default and can be turned off explicitly (e.g. -name=false).
| d | Human-readable description of what enabling this switch does. |
| default_status | Initial on/off status of the switch (default: off). |
|
inline |
|
inline |
|
inline |
|
inline |