-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.h
More file actions
46 lines (32 loc) · 837 Bytes
/
Copy pathmenu.h
File metadata and controls
46 lines (32 loc) · 837 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef MenuLibrary
#define MenuLibrary
#include <functional>
#include <iostream>
#include <string>
using EntryFunction = std::function<void()>;
struct Entry {
std::string command;
std::string description;
EntryFunction method;
};
using Entries = std::vector<Entry*>;
class Menu {
public:
Menu() = delete;
Menu(std::string menu_name);
~Menu();
void AddEntry(std::string command, std::string description,
EntryFunction method);
void EnterMenu();
void PrintMenu();
void EvaluateUserInput(std::string input);
void AddSubMenu(std::string command, std::string sub_menu_name);
Menu* GetSubMenu();
private:
std::string m_menuName;
Entries* m_entries;
Menu* m_menu;
bool m_quit;
void Quit();
}; // class MenuLib
#endif // MenuLibrary