diff options
author | Steru <jerrydream111@gmail.com> | 2024-08-16 15:39:05 +0200 |
---|---|---|
committer | Steru <jerrydream111@gmail.com> | 2024-08-16 23:53:31 +0200 |
commit | b825a98d95dd9fa432a161d95eb6454536e01af4 (patch) | |
tree | 4a55a4f3907d8843cf56eabcbda6629266499123 /src/model/CompetitorWithResults.h | |
parent | b869b8983656b12f9dee59439acfb6b3db647b72 (diff) |
Fixed constructors.
Diffstat (limited to 'src/model/CompetitorWithResults.h')
-rw-r--r-- | src/model/CompetitorWithResults.h | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/model/CompetitorWithResults.h b/src/model/CompetitorWithResults.h index 2203064..a98a1e8 100644 --- a/src/model/CompetitorWithResults.h +++ b/src/model/CompetitorWithResults.h @@ -6,7 +6,6 @@ #include <QMap> #include <QJsonObject> #include <QObject> -#include <stdexcept> class CompetitorWithResults : public Competitor { @@ -17,19 +16,16 @@ class CompetitorWithResults : public Competitor { Q_PROPERTY(QString statistic READ statistic NOTIFY nStatistic) public: - CompetitorWithResults() : Competitor(), m_mark(""), m_medalType("") {} - CompetitorWithResults(const CompetitorWithResults &competitor) : Competitor(competitor), - m_mark(competitor.m_mark), m_medalType(competitor.m_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); - } + explicit CompetitorWithResults(Competitor *parent) : Competitor(parent) {} bool setResults(const QJsonObject &results); + void setMark(QString mark) { this->m_mark = mark; } + void setMedalType(QString medalType) { this->m_medalType = medalType; } void setStatistic(QString stat) { this->m_statistic = stat; } + bool setCompetitorWithResults(const QJsonObject &competitor); + void setCompetitorWithResults(const CompetitorWithResults &competitor); + QString getMark() { return this->m_mark; } QString getMedalType() { return this->m_medalType; } QString getStatistic() { return this->m_statistic; } |