From 94fb05a764c1d0d1f275f29ecd21686d835f9768 Mon Sep 17 00:00:00 2001 From: Steru Date: Mon, 12 Aug 2024 22:09:50 +0200 Subject: Created Model for competitors. --- src/model/CompetitorWithResults.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/model/CompetitorWithResults.h (limited to 'src/model/CompetitorWithResults.h') diff --git a/src/model/CompetitorWithResults.h b/src/model/CompetitorWithResults.h new file mode 100644 index 0000000..cb952f2 --- /dev/null +++ b/src/model/CompetitorWithResults.h @@ -0,0 +1,28 @@ + +#ifndef ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H +#define ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H + +#include "Competitor.h" +#include +#include +#include +#include + +class CompetitorWithResults : public Competitor { + +public: + 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); + +private: + QMap results; + +}; + + +#endif //ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H -- cgit v1.2.3