diff options
Diffstat (limited to 'src/menu.h')
-rw-r--r-- | src/menu.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/menu.h b/src/menu.h new file mode 100644 index 0000000..1b91b88 --- /dev/null +++ b/src/menu.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef MENU_H_3F6E62B3 | ||
2 | #define MENU_H_3F6E62B3 | ||
3 | |||
4 | #include <memory> | ||
5 | #include <string> | ||
6 | #include <vector> | ||
7 | |||
8 | enum class MenuType { | ||
9 | Command | ||
10 | }; | ||
11 | |||
12 | struct MenuItem { | ||
13 | MenuType type = MenuType::Command; | ||
14 | std::string text; | ||
15 | }; | ||
16 | |||
17 | class MenuBuilder { | ||
18 | public: | ||
19 | |||
20 | MenuBuilder& Command(std::string text) { | ||
21 | result_.type = MenuType::Command; | ||
22 | result_.text = std::move(text); | ||
23 | return *this; | ||
24 | } | ||
25 | |||
26 | MenuItem Build() const { | ||
27 | return result_; | ||
28 | } | ||
29 | |||
30 | private: | ||
31 | |||
32 | MenuItem result_; | ||
33 | }; | ||
34 | |||
35 | std::vector<MenuItem> CreateMenu(const std::vector<MenuBuilder>& builders); | ||
36 | |||
37 | #endif /* end of include guard: MENU_H_3F6E62B3 */ | ||