goptions
Loading...
Searching...
No Matches
gswitch.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <string>
9
28{
29public:
38 GSwitch() = default;
39
51 GSwitch(const std::string& d, bool default_status = false) : description(d), status(default_status) {
52 }
53
61 void turnOn() { status = true; }
62
70 void turnOff() { status = false; }
71
77 bool getStatus() const { return status; }
78
84 const std::string& getDescription() const { return description; }
85
86private:
94 std::string description;
95
103 bool status{false};
104};
Represents a boolean command-line switch with a description and a status.
Definition gswitch.h:28
void turnOn()
Turns the switch on.
Definition gswitch.h:61
const std::string & getDescription() const
Retrieves the description of the switch.
Definition gswitch.h:84
void turnOff()
Turns the switch off.
Definition gswitch.h:70
bool getStatus() const
Retrieves the current status of the switch.
Definition gswitch.h:77
GSwitch(const std::string &d, bool default_status=false)
Parameterized constructor.
Definition gswitch.h:51
GSwitch()=default
Default constructor.