-
Notifications
You must be signed in to change notification settings - Fork 0
/
Menu.h
44 lines (37 loc) · 858 Bytes
/
Menu.h
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
#ifndef SDDS_MENU_H
#define SDDS_MENU_H
#include <iostream>
namespace sdds {
int const MAX_MENU_ITEMS = 20;
class Menu;
class MenuItem {
char* m_item;
MenuItem();
MenuItem(const char*);
~MenuItem();
operator bool() const;
operator const char* ();
std::ostream& display(std::ostream& os = std::cout);
friend class Menu;
};
class Menu {
MenuItem m_title;
MenuItem* m_items[MAX_MENU_ITEMS];
int m_itemCount;
public:
Menu();
Menu(const char*);
~Menu();
int run();
int operator~();
std::ostream& displayTitle(std::ostream& os = std::cout);
std::ostream& displayMenu(std::ostream& os = std::cout);
operator bool() const;
Menu& operator<<(const char*);
operator int() const;
operator unsigned int() const;
char* operator[](int i) const;
};
std::ostream& operator<<(std::ostream& os, Menu& item);
}
#endif