blob: e5b0251866a3241087df77c13d55a2387ac2e86a (
plain)
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
|
#ifndef ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H
#define ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H
#include <QString>
#include <QMap>
#include <QJsonObject>
#include <QAbstractListModel>
#include <stdexcept>
using namespace std;
class Competitor {
Q_OBJECT
Q_PROPERTY(int code READ code)
Q_PROPERTY(QString name READ name)
Q_PROPERTY(QString noc READ noc)
public:
Competitor() {
this->code = 0;
this->name = "na";
this->noc = "---";
}
Competitor(const Competitor &competitor) {
this->code = competitor.code;
this->name = competitor.name;
this->noc = competitor.noc;
}
Competitor(const QJsonObject &competitor) {
setCompetitor(competitor);
}
int getCode() { return this->code; }
QString getName() { return this->name; }
QString getNOC() { return this->noc; }
void setCode(int code) { this->code = code; }
void setName(QString name) { this->name = name; }
void setNOC(QString noc) { this->noc = noc; }
bool setCompetitor(const QJsonObject &competitor);
static bool compareName(const Competitor &left, const Competitor &right) {
return left.name.compare(right.name) < 0;
}
static bool compareNOC(const Competitor &left, const Competitor &right) {
return left.noc.compare(right.noc) < 0;
}
private:
int code;
QString name;
QString noc;
};
#endif //ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H
|