diff options
Diffstat (limited to 'src/model/Competitor.h')
-rw-r--r-- | src/model/Competitor.h | 71 |
1 files changed, 57 insertions, 14 deletions
diff --git a/src/model/Competitor.h b/src/model/Competitor.h index 1913325..e27b537 100644 --- a/src/model/Competitor.h +++ b/src/model/Competitor.h @@ -14,39 +14,82 @@ 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) + Q_PROPERTY(int code READ code NOTIFY codeChanged) + Q_PROPERTY(QString name READ name NOTIFY nameChanged) + Q_PROPERTY(QString noc READ noc NOTIFY nocChanged) + + // results in a certain event/category + Q_PROPERTY(QString mark READ mark NOTIFY markChanged) + Q_PROPERTY(QString medalType READ medalType NOTIFY medalTypeChanged) + Q_PROPERTY(QString statistic READ statistic NOTIFY statisticChanged) + + // medal amounts in the whole discipline + Q_PROPERTY(int gold READ gold NOTIFY goldChanged) + Q_PROPERTY(int silver READ silver NOTIFY silverChanged) + Q_PROPERTY(int bronze READ bronze NOTIFY bronzeChanged) public: explicit Competitor(QObject *parent) : QObject(parent) {} - int getCode() { return this->m_code; } - QString getName() { return this->m_name; } - QString getNOC() { return this->m_noc; } + // getter + int code() const { return this->m_code; } + QString name() const { return this->m_name; } + QString noc() const { return this->m_noc; } + QString mark() const { return this->m_mark; } + QString medalType() const { return this->m_medalType; } + QString statistic() const { return this->m_statistic; } + int gold() const { return this->m_gold; } + int silver() const { return this->m_silver; } + int bronze() const { return this->m_bronze; } + // setter void setCode(int code) { this->m_code = code; } void setName(QString name) { this->m_name = name; } void setNOC(QString noc) { this->m_noc = noc; } + void setMark(QString mark) { this->m_mark = mark; } + void setMedalType(QString medalType) { this->m_medalType = medalType; } + void setStatistic(QString stat) { this->m_statistic = stat; } + void setGold(int gold) { this->m_gold = gold; } + void setSilver(int silver) { this->m_silver = silver; } + void setBronze(int bronze) { this->m_bronze = bronze; } + + bool setResults(const QJsonObject &results); + bool setMedals(const map<QString, int> &medals); bool setCompetitor(const QJsonObject &competitor); - bool setCompetitor(const Competitor &competitor); + void setCompetitor(const Competitor &competitor); - static bool compareName(const Competitor &left, const Competitor &right) { - return left.m_name.compare(right.m_name) < 0; + static bool compareName(Competitor lComp, Competitor rComp) { + return lComp.m_name.compare(rComp.m_name) < 0; } - static bool compareNOC(const Competitor &left, const Competitor &right) { - return left.m_noc.compare(right.m_noc) < 0; + static bool compareNOC(Competitor lComp, Competitor rComp) { + return lComp.m_noc.compare(rComp.m_noc) < 0; } + static bool compareMark(Competitor lComp, Competitor rComp); + static bool compareMedals(Competitor lComp, Competitor rComp); + signals: - void nCode(); - void nName(); - void nNoc(); + void codeChanged(); + void nameChanged(); + void nocChanged(); + void markChanged(); + void medalTypeChanged(); + void statisticChanged(); + void goldChanged(); + void silverChanged(); + void bronzeChanged(); private: int m_code; QString m_name; QString m_noc; + QString m_mark; + QString m_medalType; + QString m_statistic; + + int m_gold; + int m_silver; + int m_bronze; }; |