summaryrefslogtreecommitdiff
path: root/src/model/Competitor.cpp
blob: 080dd4d2866f2584f80ea9b882b65343864af7f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

#include "Competitor.h"

bool Competitor::setCompetitor(const QJsonObject &competitor) {
    if (!competitor.contains("code")
        || !competitor.contains("name")
        || !competitor.contains("m_noc")) {
        throw invalid_argument("Not a competitor object.");
    }

    this->m_code = competitor["code"].toInt();
    this->m_name = competitor["name"].toString();
    this->m_noc = competitor["m_noc"].toString();
    return true;
}