|
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) | |
| 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 forces the status to false (off). This guarantees that defining a switch never enables it implicitly; only parsing or explicit programmatic calls enable it.
| d | Human-readable description of what enabling this switch does. |
|
inline |
|
inline |
|
inline |
|
inline |