The Battle for Wesnoth  1.15.0-dev
Classes | Typedefs | Functions
info.hpp File Reference
#include "game_version.hpp"
#include "addon/validation.hpp"
#include <ctime>
#include <set>
#include <map>
Include dependency graph for info.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  addon_info
 

Typedefs

typedef std::map< std::string, addon_infoaddons_list
 

Functions

void read_addons_list (const config &cfg, addons_list &dest)
 Parse the specified add-ons list WML into an actual addons_list object. More...
 
std::string size_display_string (double size)
 Get a human-readable representation of the specified byte count. More...
 
std::string make_addon_title (const std::string &id)
 Replaces underscores to dress up file or dirnames as add-on titles. More...
 

Typedef Documentation

◆ addons_list

typedef std::map<std::string, addon_info> addons_list

Definition at line 26 of file info.hpp.

Function Documentation

◆ make_addon_title()

std::string make_addon_title ( const std::string &  id)

Replaces underscores to dress up file or dirnames as add-on titles.

Todo:
In the future we should store more local information about add-ons and use this only as a fallback; it could be desirable to fetch translated names as well somehow.

Definition at line 226 of file info.cpp.

Referenced by gui2::dialogs::addon_manager::delete_addon(), addons_client::delete_remote_addon(), addon_info::display_title(), addons_client::do_resolve_addon_dependencies(), addon_info::operator=(), and addons_client::upload_addon().

◆ read_addons_list()

void read_addons_list ( const config cfg,
addons_list dest 
)

Parse the specified add-ons list WML into an actual addons_list object.

Parameters
cfgAdd-ons list WML, currently a [campaigns] node from a server response.
destTarget addons_list object. It will be cleared first.

Referenced by addon_info::operator=().

◆ size_display_string()

std::string size_display_string ( double  size)

Get a human-readable representation of the specified byte count.

The result includes the size unit, which is the largest byte multiply that makes sense. (e.g. 1 MiB for 1048576 bytes.)

Definition at line 217 of file info.cpp.

References _(), and utils::si_string().

Referenced by gui2::dialogs::addon_manager::on_addon_select(), addon_info::operator=(), and gui2::addon_list::set_addons().