-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfrontend.h
60 lines (50 loc) · 1.4 KB
/
frontend.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* @class Frontend
* @author Stephen M. Reaves
* @headerfile frontend.h
* @date Sep 16, 2018
* @brief Abstract class for User Interfaces
*/
#ifndef FRONTEND_H
#define FRONTEND_H
#include <ncurses.h>
#include <cstdlib>
#include <iostream>
#include <string>
#include "belt.h"
#include "pants.h"
#include "shirt.h"
#include "shoes.h"
#include "socks.h"
#ifdef SQL
#include "sql.h"
#else
#include "map.h"
#endif
using namespace std;
class Frontend {
public:
// Define these with empty braces to not inherit
Frontend(){};
virtual ~Frontend(){};
// These abstract functions will be different for each type of frontend
virtual bool Init() = 0; ///< Starts frontend and returns boolean determining
///< if frontend was started correctly
virtual void Die() = 0; ///< Kills frontend
virtual void CreateCloset() = 0; ///< Initializes Backend
virtual string MakeWindow(
string message) = 0; ///< Puts message in window and returns string
virtual char MakeWindowChar(
string message) = 0; ///< Puts message in window and returns char
string GetClosetName() { return backend_.GetClosetName(); };
string ToString() const { return backend_.ToString(); };
protected:
bool is_init_ = false; ///< True if window is started, fasle otherwise
string closet_name_ = kDummyClosetName;
#ifdef SQL
SQL backend_;
#else
Map backend_;
#endif
};
#endif /* FRONTEND_H */