The Battle for Wesnoth  1.17.0-dev
game_history.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2020 - 2021
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  int reload;
36  std::string game_start;
37  std::string scenario_name;
38  std::string scenario_id;
39  std::string era_name;
40  std::string era_id;
41  std::vector<player> players;
42  std::vector<std::string> modification_names;
43  std::vector<std::string> modification_ids;
44  std::string replay_url;
45  };
46 
47  public:
48  void read(mariadb::result_set_ref rslt);
49  std::unique_ptr<simple_wml::document> to_doc();
50 
51  private:
52  std::vector<result> results;
53 };
void read(mariadb::result_set_ref rslt)
std::string game_start
std::vector< player > players
std::vector< std::string > modification_names
std::vector< result > results
std::vector< std::string > modification_ids
std::string replay_url
std::string scenario_name
std::unique_ptr< simple_wml::document > to_doc()
std::string scenario_id