The Battle for Wesnoth  1.19.0-dev
game_history.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2020 - 2024
3  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 #pragma once
16 
17 #include <vector>
18 
19 #include "mariadb++/result_set.hpp"
20 
23 
24 class game_history : public rs_base
25 {
26  struct player
27  {
28  std::string name;
29  std::string faction;
30  };
31 
32  struct result
33  {
34  std::string game_name;
35  std::string game_start;
36  std::string scenario_name;
37  std::string era_name;
38  std::vector<player> players;
39  std::vector<std::string> modification_names;
40  std::string replay_url;
41  std::string version;
42  };
43 
44  public:
45  void read(mariadb::result_set_ref rslt);
46  std::unique_ptr<simple_wml::document> to_doc();
47 
48  private:
49  std::vector<result> results;
50 };
void read(mariadb::result_set_ref rslt)
std::unique_ptr< simple_wml::document > to_doc()
std::vector< result > results
std::vector< std::string > modification_names
std::vector< player > players
std::string game_start
std::string scenario_name
std::string replay_url