blob: 79552a54c0214ef697ad44973dc993609a690e7a (
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
|
#pragma once
#include <QString>
#include <QMap>
#include <QJsonObject>
#include <QObject>
using namespace std;
class Competitor : public QObject {
Q_OBJECT
Q_PROPERTY(int code READ code NOTIFY nCode)
Q_PROPERTY(QString name READ name NOTIFY nName)
Q_PROPERTY(QString noc READ noc NOTIFY nNoc)
public:
Competitor() : m_code(0), m_name(""), m_noc("") {}
Competitor(const Competitor &competitor) : m_code(competitor.m_code), m_name(competitor.m_name), m_noc(competitor.m_noc) {}
Competitor(const QJsonObject &competitor) { setCompetitor(competitor); }
int getCode() { return this->m_code; }
QString getName() { return this->m_name; }
QString getNOC() { return this->m_noc; }
void setCode(int code) { this->m_code = code; }
void setName(QString name) { this->m_name = name; }
void setNOC(QString noc) { this->m_noc = noc; }
bool setCompetitor(const QJsonObject &competitor);
static bool compareName(const Competitor &left, const Competitor &right) {
return left.m_name.compare(right.m_name) < 0;
}
static bool compareNOC(const Competitor &left, const Competitor &right) {
return left.m_noc.compare(right.m_noc) < 0;
}
signals:
void nCode();
void nName();
void nNoc();
private:
int m_code;
QString m_name;
QString m_noc;
};
|