summaryrefslogtreecommitdiff
path: root/src/model/Competitor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/Competitor.cpp')
-rw-r--r--src/model/Competitor.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/model/Competitor.cpp b/src/model/Competitor.cpp
new file mode 100644
index 0000000..a5d2e69
--- /dev/null
+++ b/src/model/Competitor.cpp
@@ -0,0 +1,15 @@
+
+#include "Competitor.h"
+
+bool Competitor::setCompetitor(const QJsonObject &competitor) {
+ if (!competitor.contains("code")
+ || !competitor.contains("name")
+ || !competitor.contains("noc")) {
+ throw invalid_argument("Not a competitor object.");
+ }
+
+ this->code = competitor["code"].toString();
+ this->name = competitor["name"].toString();
+ this->noc = competitor["noc"].toString();
+ return true;
+}