#pragma once #include #include #include #include using namespace std; class Competitor { Q_OBJECT Q_PROPERTY(int code READ code NOTIFY nCode) Q_PROPERTY(QString name READ name NOTIFY nName) Q_PROPERTY(QString noc READ noc NOTIFY nNoc) public: Competitor() { this->code = 0; this->name = ""; this->noc = ""; } Competitor(const Competitor &competitor) { this->code = competitor.code; this->name = competitor.name; this->noc = competitor.noc; } Competitor(const QJsonObject &competitor) { setCompetitor(competitor); } int getCode() { return this->code; } QString getName() { return this->name; } QString getNOC() { return this->noc; } void setCode(int code) { this->code = code; } void setName(QString name) { this->name = name; } void setNOC(QString noc) { this->noc = noc; } bool setCompetitor(const QJsonObject &competitor); static bool compareName(const Competitor &left, const Competitor &right) { return left.name.compare(right.name) < 0; } static bool compareNOC(const Competitor &left, const Competitor &right) { return left.noc.compare(right.noc) < 0; } private: int code; QString name; QString noc; };