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 23:27:54 +02:00
|
|
|
#include <QObject>
|
2024-08-16 15:39:05 +02:00
|
|
|
#include <qqml.h>
|
2024-08-15 23:27:54 +02:00
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2024-08-15 23:27:54 +02:00
|
|
|
class Competitor : public QObject {
|
2024-08-12 22:09:50 +02:00
|
|
|
|
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-16 15:39:05 +02:00
|
|
|
explicit Competitor(QObject *parent) : QObject(parent) {}
|
2024-08-15 19:21:02 +02:00
|
|
|
|
2024-08-15 23:27:54 +02:00
|
|
|
int getCode() { return this->m_code; }
|
|
|
|
QString getName() { return this->m_name; }
|
|
|
|
QString getNOC() { return this->m_noc; }
|
2024-08-12 22:09:50 +02:00
|
|
|
|
2024-08-15 23:27:54 +02:00
|
|
|
void setCode(int code) { this->m_code = code; }
|
|
|
|
void setName(QString name) { this->m_name = name; }
|
|
|
|
void setNOC(QString noc) { this->m_noc = noc; }
|
2024-08-15 20:41:08 +02:00
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
bool setCompetitor(const QJsonObject &competitor);
|
2024-08-16 15:39:05 +02:00
|
|
|
bool setCompetitor(const Competitor &competitor);
|
2024-08-12 22:09:50 +02:00
|
|
|
|
2024-08-15 20:41:08 +02:00
|
|
|
static bool compareName(const Competitor &left, const Competitor &right) {
|
2024-08-15 23:27:54 +02:00
|
|
|
return left.m_name.compare(right.m_name) < 0;
|
2024-08-15 20:41:08 +02:00
|
|
|
}
|
|
|
|
static bool compareNOC(const Competitor &left, const Competitor &right) {
|
2024-08-15 23:27:54 +02:00
|
|
|
return left.m_noc.compare(right.m_noc) < 0;
|
2024-08-15 20:41:08 +02:00
|
|
|
}
|
|
|
|
|
2024-08-15 23:27:54 +02:00
|
|
|
signals:
|
|
|
|
void nCode();
|
|
|
|
void nName();
|
|
|
|
void nNoc();
|
|
|
|
|
2024-08-12 22:09:50 +02:00
|
|
|
private:
|
2024-08-15 23:27:54 +02:00
|
|
|
int m_code;
|
|
|
|
QString m_name;
|
|
|
|
QString m_noc;
|
2024-08-12 22:09:50 +02:00
|
|
|
|
|
|
|
};
|