-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.hpp
42 lines (37 loc) · 1.32 KB
/
Menu.hpp
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
/*********************************************************************
** Program Filename: Menu.hpp [HEADER]
** Author: Shawn Hillyer
** Date: 11/06/2015
** Description: Highly flexible Menu class. Reads a plaintext
** file or takes a vector of strings and allows
** user to print the menu, prompt for input, and
** validate input without having to modify anything
** inside this class.
** Input: Call with 'Menu menu_name("filename");' to
** instantiate with a file, or pass in a vector
** of strings.
** Output: Can print menu, prompt the user, and validate
** input dynamically even if new items are added
** later at runtime or after a file/vector is read
********************************************************************/
#ifndef SSHILLYER_MENU_HPP
#define SSHILLYER_MENU_HPP
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
class Menu
{
private:
std::vector<std::string> items;
char brackets[2];
public:
Menu();
void load_items(std::vector<std::string> items);
void load_menu_file(std::string filename);
void print();
int prompt_user();
bool is_valid(int value);
int get_quit_value();
};
#endif