diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-21 17:54:56 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-21 17:54:56 +0200 |
commit | 10ce9f45b9551dc103272c2b2374db1c1e3b8bcb (patch) | |
tree | 4fba15ce11c42dbfadca5cf6ff7a4c0b774ff507 /ControlBooleanCommand.cpp | |
parent | 90652f512e9621e0dfac497439c7c80bf113d9d5 (diff) |
add ControlBooleanCommand
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; +} + |