diff options
Diffstat (limited to 'ControlBooleanCommand.cpp')
-rw-r--r-- | ControlBooleanCommand.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ControlBooleanCommand.cpp b/ControlBooleanCommand.cpp new file mode 100644 index 0000000..411b428 --- /dev/null +++ b/ControlBooleanCommand.cpp @@ -0,0 +1,16 @@ +#include "ControlBooleanCommand.h" + +ControlBooleanCommand::ControlBooleanCommand(bool & t) : target(t) { + this->toggle = true; +} + +ControlBooleanCommand::ControlBooleanCommand(bool & t, bool set) : target(t) { + this->toggle = false; + this->value = set; +} + +void ControlBooleanCommand::execute() { + if (this->toggle) this->value = !this->target; + this->target = this->value; +} + |