#pragma once #include "Competitor.h" #include #include #include #include #include class CompetitorWithResults : public Competitor { Q_OBJECT Q_PROPERTY(QString mark READ mark NOTIFY nMark) Q_PROPERTY(QString medalType READ medalType NOTIFY nMedalType) Q_PROPERTY(QString statistic READ statistic NOTIFY nStatistic) public: CompetitorWithResults() : Competitor() { this->mark = ""; this->medalType = ""; } CompetitorWithResults(const CompetitorWithResults &competitor) : Competitor(competitor) { this->mark = competitor.mark; this->medalType = competitor.medalType; } CompetitorWithResults(const QJsonObject &competitor) : Competitor(competitor) { if (!competitor.contains("results")) throw invalid_argument("Competitor does not contain results."); QJsonObject results = competitor["results"].toObject(); setResults(results); } bool setResults(const QJsonObject &results); void setStatistic(QString stat) { this->statistic = stat; } QString getMark() { return this->mark; } QString getMedalType() { return this->medalType; } QString getStatistic() { return this->statistic; } static bool compare(CompetitorWithResults lComp, CompetitorWithResults rComp); private: QString mark; QString medalType; QString statistic; };