29 lines
728 B
C++
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
|