Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface / Command.h
blob: f1eb55b690951243b478cc22cc79c45ba5ed0549 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef HEADER_CONSOLEINTERFACE_COMMAND
#define HEADER_CONSOLEINTERFACE_COMMAND

/*! \file Command.h
 *  \brief Stores the declaration of class Command
 */

/*! \brief 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.
 */
class Command {
	char nameInMenu[256];
	void (*exec)();

public:
	//! Leaves name empty and exec function pointer to nullptr
	Command();
	//! Copies contents of nameInMenu and stores exec
	Command(const char* nameInMenu, void (*exec)());
	//! Executes the stored function pointer
	void run() const;

	const char* get_nameInMenu() const;
};

#endif