The Battle for Wesnoth  1.17.0-dev
about.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2021
3  by David White <dave@whitevine.net>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #pragma once
17 
18 #include "tstring.hpp"
19 
20 #include <optional>
21 #include <string>
22 #include <vector>
23 
24 class config;
25 class game_config_view;
26 
27 namespace about
28 {
30 {
31  struct about_group
32  {
33  explicit about_group(const config& cfg);
34 
35  /** Contributor names. */
36  std::vector<std::pair<std::string, std::string>> names;
37 
38  /** The section title. */
40 
41  bool operator<(const about_group& o) const;
42  };
43 
44  credits_group(const config& cfg, bool is_campaign_credits);
45 
46  /** The group's sub-groups. Corresponds to each [about] tag .*/
47  std::vector<about_group> sections;
48 
49  /** Optional group ID. Currently only used for identifying campaigns. */
50  std::string id;
51 
52  /** Optional group tite. Currently only used for identifying campaigns. */
54 };
55 
56 using credits_data = std::vector<credits_group>;
57 
58 /** Gets all credits data. */
60 
61 /** Gets credits for a given campaign. Returns a null optional if that campaign has no credits. */
62 std::optional<credits_data::const_iterator> get_campaign_credits(const std::string& campaign);
63 
64 /** Gets credit background images for a given campaaign. */
65 std::vector<std::string> get_background_images(const std::string& campaign);
66 
67 /** Regenerates the credits data. */
68 void set_about(const game_config_view& cfg);
69 
70 } // namespace about
t_string title
The section title.
Definition: about.hpp:39
const credits_data & get_credits_data()
Gets all credits data.
Definition: about.cpp:95
std::vector< about_group > sections
The group&#39;s sub-groups.
Definition: about.hpp:47
std::vector< std::string > get_background_images(const std::string &campaign)
Gets credit background images for a given campaaign.
Definition: about.cpp:107
Display credits about all contributors.
std::vector< credits_group > credits_data
Definition: about.hpp:56
std::vector< std::pair< std::string, std::string > > names
Contributor names.
Definition: about.hpp:36
void set_about(const game_config_view &cfg)
Regenerates the credits data.
Definition: about.cpp:116
credits_group(const config &cfg, bool is_campaign_credits)
Definition: about.cpp:48
about_group(const config &cfg)
Definition: about.cpp:79
std::string id
Optional group ID.
Definition: about.hpp:50
bool operator<(const about_group &o) const
Definition: about.cpp:90
std::optional< credits_data::const_iterator > get_campaign_credits(const std::string &campaign)
Gets credits for a given campaign.
Definition: about.cpp:100
t_string header
Optional group tite.
Definition: about.hpp:53
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:60