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
50 GSwitch(const std::string& d) : description(d), status(false) {
51 }
52
60 void turnOn() { status = true; }
61
69 void turnOff() { status = false; }
70
76 bool getStatus() const { return status; }
77
83 const std::string& getDescription() const { return description; }
84
85private:
93 std::string description;
94
102 bool status{false};
103};
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:60
const std::string & getDescription() const
Retrieves the description of the switch.
Definition gswitch.h:83
void turnOff()
Turns the switch off.
Definition gswitch.h:69
GSwitch(const std::string &d)
Parameterized constructor.
Definition gswitch.h:50
bool getStatus() const
Retrieves the current status of the switch.
Definition gswitch.h:76
GSwitch()=default
Default constructor.