-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjurado.cpp
148 lines (108 loc) · 2.6 KB
/
jurado.cpp
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#include "jurado.h"
#include "sessao.h"
#include "funcoes.h"
jurado::jurado() {
// TODO Auto-generated constructor stub
}
jurado::jurado(string nome , string morada , string telemovel , string artePerformativa) {
this->nome = nome;
this->morada = morada;
this->telemovel = telemovel;
this->arte = artePerformativa;
}
jurado::jurado(string info) {
stringstream ss(info);
char virgula;
getline(ss, this->nome, ',');
this->nome = this->nome.substr(0, this->nome.size() - 1);
getline(ss, this->morada, ',');
this->morada = this->morada.substr(1, this->morada.size() - 2);
ss >> telemovel >> virgula >> arte;
ss.ignore('\n');
}
std::ostream & operator<<(std::ostream &out, const JuradoNaoExiste &c){
out << "Jurado " << c.nome << " não existe !\n";
return out;
}
std::ostream & operator<<(std::ostream &out, const JuradoJaExiste &c) {
out << "Jurado " << c.nome << " já existe !\n";
return out;
}
std::ostream & operator<<(std::ostream &out, const juradoOcupado &c) {
out << "O jurado ja tem uma sessao nesse dia!\n";
return out;
}
jurado::~jurado() {
// TODO Auto-generated destructor stub
}
//metodos set()
void jurado::setNome (string nome)
{
this->nome=nome;
}
void jurado::setMorada (string morada)
{
this->morada=morada;
}
void jurado::setTelemovel (string telemovel)
{
this->telemovel=telemovel;
}
void jurado::setArte (string arte)
{
this->arte=arte;
}
void jurado::setSessoes(vector<sessao*> s) {
this->sessoes = s;
}
//metodos get()
string jurado::getNome() const
{
return nome;
}
string jurado::getMorada() const
{
return morada;
}
string jurado::getTelemovel() const
{
return telemovel;
}
string jurado::getArte() const
{
return arte;
}
vector<sessao*> jurado::getSessoes() const {
return sessoes;
}
//---------
void jurado::adicionaSessao(sessao* s) {
this->sessoes.push_back(s);
}
void jurado::removeSessao(sessao* s) {
for(unsigned int i = 0; i < sessoes.size(); i++) {
if(sessoes.at(i) == s) {
sessoes.erase(sessoes.begin()+i);
return;
}
}
}
bool jurado::juradoOcupado(vector<int> data) {
for(unsigned int i = 0; i < sessoes.size() ; i++) {
if(sessoes.at(i)->getData() == data) {
return true;
}
}
return false;
}
ostream & operator<<(ostream & o, const jurado * j) {
o << "Nome : " << j->getNome() << endl;
o << "Morada : " << j->getMorada() << endl;
o << "Telemovel : " << j->getTelemovel() << endl;
o << "Arte Perfor. : " << j->getArte() << endl;
return o;
}
ofstream & operator<<(ofstream & o, const jurado * j) {
o << j->getNome() << " , " << j->getMorada() << " , " << j->getTelemovel() << " , " << j->getArte();
return o;
}