#ifndef ITAT_CHALLANGE_OLYMPICS_SPORT_H #define ITAT_CHALLANGE_OLYMPICS_SPORT_H #include #include #include #include using namespace std; class Sport { public: Sport(QJsonObject discipline) { this->discipline = discipline; } set getCategories(); QJsonArray getCompetitorsByCategory(QString category); // filter to change the current competitor array void lastName(QJsonArray& competitors); void filterByName(QJsonArray& competitors, QString name); void filterByCountry(QJsonArray& competitors, QString nocShort); // sort functions to change the order of the current competitor array void sortByName(QJsonArray &competitors); void sortByCountry(QJsonArray &competitors); void sortByResult(QJsonArray &competitors); void setDiscipline(QJsonObject discipline) { this->discipline = QJsonObject(discipline); } private: /* * Analysis of provided competitor objects: * * Attributes: * - code * - noc (national olympics comittee) * - name (sometimes the country name? mostly the competitors name) * - order * [- results] (only if the results are out!) * * * Analysis of provided result objects: * * Attributes: * - position * - mark * - medalType * - irk * [- winnerLoserTie] (only if provided in the discipline?) */ QJsonObject discipline; void filterCompetitors(QJsonArray& competitors, QString attribute, QString filter); void sortCompetitors(QJsonArray &competitors, function compare); }; #endif //ITAT_CHALLANGE_OLYMPICS_SPORT_H