-
Notifications
You must be signed in to change notification settings - Fork 0
/
Floor.h
98 lines (79 loc) · 1.96 KB
/
Floor.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#ifndef FLOOR_HPP
#define FLOOR_HPP
#include <iostream>
#include <ostream>
#include <string>
#include "Button.h"
#include "Person.h"
using namespace std;
class Floor{
public:
Floor(){}
virtual bool togglebutton(bool value, string buttonName){}
string floorNumber;
};
class FirstFloor : public Floor
{
public:
FirstFloor(){}
FirstFloor(string number) : floorNumber(number){}
FirstFloor(string number, Person *_people) : floorNumber(number), people(_people){}
virtual void setPeople(Person *_people){
this->people = _people;
}
string getFloorNumber(){
return this->floorNumber;
}
bool togglebutton(bool value, string buttonName = "up"){
upButton.setIsClicked(value);
}
std::ostream& operator<< (std::ostream& stream, const FirstFloor& f) {
stream << f.getFloorNumber() << '\n';
return stream;
}
private:
string floorNumber;
Person *people;
UpButton upButton;
};
class LastFloor : public Floor
{
public:
LastFloor(){}
LastFloor(string number) : floorNumber(number){}
LastFloor(string number, Person *_people) : floorNumber(number), people(_people){}
virtual void setPeople(Person *_people){
this->people = _people;
}
virtual bool togglebutton(bool value, string buttonName = "down"){
downButton.setIsClicked(value);
}
private:
string floorNumber;
Person *people;
DownButton downButton;
};
class NormalFloor : public Floor
{
public:
NormalFloor(){}
NormalFloor(string number) : floorNumber(number){}
NormalFloor(string number, Person *_people) : floorNumber(number), people(_people){}
virtual void setPeople(Person *_people){
this->people = _people;
}
virtual bool togglebutton(bool value, string buttonName){
if(buttonName == "down"){
downButton.setIsClicked(value);
}
if(buttonName == "up"){
upButton.setIsClicked(value);
}
}
private:
string floorNumber;
Person *people;
DownButton downButton;
UpButton upButton;
};
#endif