summaryrefslogtreecommitdiff
path: root/src/model/Competitor.cpp
blob: a58468932bd0ad5bf21f2f34a19cacabbc6d1615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

#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.");
    }

    setCode(competitor["code"].toInt());
    setName(competitor["name"].toString());
    setNOC(competitor["m_noc"].toString());
    return true;
}

bool Competitor::setCompetitor(const Competitor &competitor) {
    setCode(competitor.m_code);
    setName(competitor.m_name);
    setNOC(competitor.m_noc);
    return true;
}