FMI Table
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 2 | Project Topic 7 |
Command.h
Go to the documentation of this file.
1#ifndef HEADER_CONSOLEINTERFACE_COMMAND
2#define HEADER_CONSOLEINTERFACE_COMMAND
3
12class Command {
13 char name[256];
14 void (*exec)(const char* params);
15
16public:
18 Command();
20 Command(const char* name, void (*exec)(const char* params));
22 void run(const char* params) const;
23
24 const char* get_name() const;
25};
26
27#endif
Stores a 256 character name and a function pointer to be executed when calling run()
Definition: Command.h:12
Command()
Leaves name empty and exec function pointer to nullptr.
Definition: Command.cpp:4
void run(const char *params) const
Executes the stored function pointer.
Definition: Command.cpp:17