Actually fetch and display the top 10 scores.
[ccbs] / bigscreen / fetch_top_scores_for_tournament.h
1 #ifndef _FETCH_TOP_SCORES_FOR_TOURNAMENT_H
2 #define _FETCH_TOP_SCORES_FOR_TOURNAMENT_H 1
3
4 #include <pqxx/transactor>
5 #include <vector>
6 #include "widestring.h"
7
8 struct TopScore {
9         widestring nick, title, shorttitle;
10         unsigned score;
11
12         bool operator< (const TopScore &other) const;
13 };
14
15 /* A transactor that fetches the best N scores for a given tournament */
16 class FetchTopScoresForTournament : public pqxx::transactor<> {
17 private:
18         unsigned tournament, num;
19         std::vector<TopScore> *scores;
20
21 public:
22         FetchTopScoresForTournament(unsigned tournament, unsigned num, std::vector<TopScore> *scores);
23         void operator() (pqxx::transaction<> &t);
24 };
25
26 #endif /* !defined(_FETCH_TOP_SCORES_FOR_TOURNAMENT_H) */