X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Ffetch_top_scores_for_tournament.h;fp=bigscreen%2Ffetch_top_scores_for_tournament.h;h=78492ed36658c27038206f92fdb7618f5df5e607;hp=0000000000000000000000000000000000000000;hb=0e17c7dcfd783acd4792c392c347e5e523757de3;hpb=5a591d5e5db52bb78fd794342f090c7db66211dd diff --git a/bigscreen/fetch_top_scores_for_tournament.h b/bigscreen/fetch_top_scores_for_tournament.h new file mode 100644 index 0000000..78492ed --- /dev/null +++ b/bigscreen/fetch_top_scores_for_tournament.h @@ -0,0 +1,26 @@ +#ifndef _FETCH_TOP_SCORES_FOR_TOURNAMENT_H +#define _FETCH_TOP_SCORES_FOR_TOURNAMENT_H 1 + +#include +#include +#include "widestring.h" + +struct TopScore { + widestring nick, title, shorttitle; + unsigned score; + + bool operator< (const TopScore &other) const; +}; + +/* A transactor that fetches the best N scores for a given tournament */ +class FetchTopScoresForTournament : public pqxx::transactor<> { +private: + unsigned tournament, num; + std::vector *scores; + +public: + FetchTopScoresForTournament(unsigned tournament, unsigned num, std::vector *scores); + void operator() (pqxx::transaction<> &t); +}; + +#endif /* !defined(_FETCH_TOP_SCORES_FOR_TOURNAMENT_H) */