itat_challenge/src/model/CompetitorWithResults.h
2024-08-12 22:09:50 +02:00

29 lines
728 B
C++

#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