Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface / Command.h
blob: 393d70585a5c6c3788d2706b8951457288689ce6 (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 name[256];
	void (*exec)(const char* params);

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

	const char* get_name() const;
};

#endif