summaryrefslogtreecommitdiff
path: root/src/model/CompetitorWithResults.h
blob: cb952f2e5970cc36e4825a7ae6c8d1b2d2d1fa71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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