2024-08-12 22:09:50 +02:00
|
|
|
|
2024-08-15 21:00:18 +02:00
|
|
|
#pragma once
|
2024-08-12 22:09:50 +02:00
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QMap>
|
|
|
|
#include <QJsonObject>
|
2024-08-15 19:21:02 +02:00
|
|
|
#include <QAbstractListModel>
|
2024-08-12 22:09:50 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
class Competitor {
|
|
|
|
|
2024-08-15 19:21:02 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2024-08-15 21:00:18 +02:00
|
|
|
Q_PROPERTY(int code READ code NOTIFY nCode)
|
|
|
|
Q_PROPERTY(QString name READ name NOTIFY nName)
|
|
|
|
Q_PROPERTY(QString noc READ noc NOTIFY nNoc)
|
2024-08-15 19:21:02 +02:00
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
public:
|
2024-08-15 19:21:02 +02:00
|
|
|
Competitor() {
|
|
|
|
this->code = 0;
|
2024-08-15 21:00:18 +02:00
|
|
|
this->name = "";
|
|
|
|
this->noc = "";
|
2024-08-15 19:21:02 +02:00
|
|
|
}
|
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
Competitor(const Competitor &competitor) {
|
|
|
|
this->code = competitor.code;
|
|
|
|
this->name = competitor.name;
|
|
|
|
this->noc = competitor.noc;
|
|
|
|
}
|
|
|
|
|
|
|
|
Competitor(const QJsonObject &competitor) {
|
|
|
|
setCompetitor(competitor);
|
|
|
|
}
|
|
|
|
|
2024-08-15 19:21:02 +02:00
|
|
|
int getCode() { return this->code; }
|
2024-08-12 22:09:50 +02:00
|
|
|
QString getName() { return this->name; }
|
|
|
|
QString getNOC() { return this->noc; }
|
|
|
|
|
2024-08-15 20:41:08 +02:00
|
|
|
void setCode(int code) { this->code = code; }
|
|
|
|
void setName(QString name) { this->name = name; }
|
|
|
|
void setNOC(QString noc) { this->noc = noc; }
|
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
bool setCompetitor(const QJsonObject &competitor);
|
|
|
|
|
2024-08-15 20:41:08 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
private:
|
2024-08-15 19:21:02 +02:00
|
|
|
int code;
|
2024-08-12 22:09:50 +02:00
|
|
|
QString name;
|
|
|
|
QString noc;
|
|
|
|
|
|
|
|
};
|