|
FMI Table
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 2 | Project Topic 7 |
|
Stores a 256 character name and a function pointer to be executed when calling run() More...
#include <Command.h>
Public Member Functions | |
| Command () | |
| Leaves name empty and exec function pointer to nullptr. | |
| Command (const char *name, void(*exec)(const char *params)) | |
| Copies contents of nameInMenu and stores exec. More... | |
| void | run (const char *params) const |
| Executes the stored function pointer. More... | |
| const char * | get_name () const |
Stores a 256 character name and a function pointer to be executed when calling run()
Menu uses this class for a more generic implementation of it's navigate function.
| Command::Command | ( | const char * | name, |
| void(*)(const char *params) | exec | ||
| ) |
Copies contents of nameInMenu and stores exec.
| name | C-style string, class stores at most 255 characters (last character is always terminating zero) |
| exec | Function pointer that will be executed when run() is called. Can be nullptr. |
| void Command::run | ( | const char * | params | ) | const |
Executes the stored function pointer.
Executes the stored function pointer, when it's not nullptr. Otherwise does nothing.