summaryrefslogtreecommitdiff
path: root/src/model/CompetitorWithResults.h
diff options
context:
space:
mode:
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