summaryrefslogtreecommitdiff
path: root/src/model/CompetitorWithResults.h
diff options
context:
space:
mode:
authorSteru <jerrydream111@gmail.com>2024-08-12 22:09:50 +0200
committerSteru <jerrydream111@gmail.com>2024-08-12 22:09:50 +0200
commit94fb05a764c1d0d1f275f29ecd21686d835f9768 (patch)
tree283d60ee309ca35132c3cd64b55d018cc2cbfc87 /src/model/CompetitorWithResults.h
parentc539242efa11538e5e3f91bf3ff2f0de1c526bed (diff)
Created Model for competitors.
Diffstat (limited to 'src/model/CompetitorWithResults.h')
-rw-r--r--src/model/CompetitorWithResults.h28
1 files changed, 28 insertions, 0 deletions
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 <QString>
+#include <QMap>
+#include <QJsonObject>
+#include <stdexcept>
+
+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<QString, QString> results;
+
+};
+
+
+#endif //ITAT_CHALLANGE_OLYMPICS_COMPETITORWITHRESULTS_H