diff options
1 files changed, 18 insertions, 0 deletions
| -rw-r--r-- | src/Generic/ConsoleInterface/Command.cpp | 18 |
diff --git a/src/Generic/ConsoleInterface/Command.cpp b/src/Generic/ConsoleInterface/Command.cpp new file mode 100644 index 0000000..d3d058c --- /dev/null +++ b/src/Generic/ConsoleInterface/Command.cpp @@ -0,0 +1,18 @@ +#include "Command.h" +#include <cstring> + +Command::Command() : Command("", nullptr) {} + +Command::Command(const char* nameInMenu, void (*exec)()) { + strcpy(this->nameInMenu, nameInMenu); + this->exec = exec; +} + +void Command::run() const { + if (exec != nullptr) + exec(); +} + +const char* Command::get_nameInMenu() const { + return nameInMenu; +} |
