-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplane.h
110 lines (98 loc) · 2.26 KB
/
plane.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
99
100
101
102
103
104
105
106
107
108
109
110
#pragma once
#include<fstream>
#include<string>
#include <vector>
#include<iostream>
using namespace std;
/*!
\brief Main class of project, consist realisation of object Plane.
Connect with class Direction.
*/
class Plane {
private:
string pilotname;
string info;
string name;
int maxrange;
int speed;
bool isDirection;
public:
Plane() {
isDirection = 0;
}
Plane(string name, string pilotname, string info, int maxrange, int speed) : name(name), pilotname(pilotname), info(info), maxrange(maxrange), speed(speed) {
isDirection = 0;
}
friend ostream& operator<< (ostream& out, const Plane& plane)
{
out<<plane.name<<endl<<plane.pilotname<<endl<<plane.info<<endl<<plane.maxrange<<endl<<plane.speed;
return out;
}
friend istream& operator>> (istream& is, Plane& plane)
{
is >> plane.name >> plane.pilotname >> plane.info >> plane.maxrange>> plane.speed;
return is;
}
void SetName(string s) {
this->name = s;
}
string GetName() {
return this->name;
}
void SetPilotname(string s) {
this->pilotname = s;
}
string GetPilotname() {
return this->pilotname;
}
void SetInfo(string s) {
this->info = s;
}
string GetInfo() {
return this->info;
}
void SetMaxrange(int i) {
this->maxrange = i;
}
int GetMaxrange() {
return this->maxrange;
}
void SetSpeed(int i) {
this->speed = i;
}
int GetSpeed() {
return this->speed;
}
int GetState() {
return this->isDirection;
}
void SetState(bool t) {
this->isDirection = t;
}
void print() {
cout << "Name: " << this->name << endl;
cout << "Pilot name: " << this->pilotname << endl;
cout << "Info: " << this->info << endl;
cout << "Maxrange: " << this->maxrange << endl;
cout << "Speed: " << this->speed << endl;
cout << (isDirection ? "Plane have direction" : "Plane doesnt have direction" )<< endl;
}
~Plane() {
}
};
/*!
\brief Wrapper class which work with class Plane, ñonsist vector<Plane> and functions to work with them.
*/
class plane_Menu {
private:
size_t size;
public:
vector<Plane> vec;
void findPlaneByName(string fname);
void edit(int index, string info, string newvalue);
void pushFront(string name, string pilotname, string info, int maxrange, int speed);
void print();
void readFile(string fileName);
void printFile(string fileName);
void del(int index);
};