From b825a98d95dd9fa432a161d95eb6454536e01af4 Mon Sep 17 00:00:00 2001 From: Steru Date: Fri, 16 Aug 2024 15:39:05 +0200 Subject: Fixed constructors. --- src/model/CompetitorWithResults.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/model/CompetitorWithResults.h') 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 #include #include -#include 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; } -- cgit v1.2.3