#ifndef ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H #define ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H #include #include #include #include #include using namespace std; class Competitor { Q_OBJECT Q_PROPERTY(int code READ code) Q_PROPERTY(QString name READ name) Q_PROPERTY(QString noc READ noc) public: Competitor() { this->code = 0; this->name = "na"; 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; }; #endif //ITAT_CHALLANGE_OLYMPICS_COMPETITOR_H