The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions
manager.hpp File Reference
#include "addon/validation.hpp"
#include <string>
#include <vector>
#include <utility>
Include dependency graph for manager.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  invalid_pbl_exception
 Exception thrown when the WML parser fails to read a .pbl file. More...
 

Functions

bool remove_local_addon (const std::string &addon)
 
bool have_addon_pbl_info (const std::string &addon_name)
 Returns true if there's a local .pbl file stored for the specified add-on. More...
 
bool have_addon_in_vcs_tree (const std::string &addon_name)
 Returns true if the specified add-ons appear to be managed by a 'supported' VCS. More...
 
config get_addon_pbl_info (const std::string &addon_name)
 Gets the publish information for an add-on. More...
 
void set_addon_pbl_info (const std::string &addon_name, const class config &cfg)
 Sets the publish information for an add-on. More...
 
bool have_addon_install_info (const std::string &addon_name)
 Returns true if there is a local installation info (_info.cfg) file for the add-on. More...
 
void get_addon_install_info (const std::string &addon_name, class config &cfg)
 Gets the installation info (_info.cfg) for an add-on. More...
 
std::vector< std::string > available_addons ()
 Returns a list of local add-ons that can be published. More...
 
std::vector< std::string > installed_addons ()
 Retrieves the names of all installed add-ons. More...
 
bool is_addon_installed (const std::string &addon_name)
 Check whether the specified add-on is currently installed. More...
 
void archive_addon (const std::string &addon_name, class config &cfg)
 Archives an add-on into a config object for campaignd transactions. More...
 
void unarchive_addon (const class config &cfg)
 Unarchives an add-on from campaignd's retrieved config object. More...
 
void refresh_addon_version_info_cache ()
 Refreshes the per-session cache of add-on's version information structs. More...
 
version_info get_addon_version_info (const std::string &addon)
 Returns a particular installed add-on's version information. More...
 

Function Documentation

void archive_addon ( const std::string &  addon_name,
class config cfg 
)

Archives an add-on into a config object for campaignd transactions.

Definition at line 298 of file manager.cpp.

References config::add_child(), archive_dir(), filesystem::get_addons_dir(), and read_ignore_patterns().

Referenced by addons_client::upload_addon().

std::vector<std::string> available_addons ( )

Returns a list of local add-ons that can be published.

Definition at line 132 of file manager.cpp.

References filesystem::file_exists(), filesystem::get_addons_dir(), filesystem::get_files_in_dir(), have_addon_pbl_info(), and i.

Referenced by gui2::dialogs::addon_manager::load_addon_list().

void get_addon_install_info ( const std::string &  addon_name,
class config cfg 
)

Gets the installation info (_info.cfg) for an add-on.

Parameters
addon_nameThe add-on's main directory/file name.
cfgA config object to store the add-on's properties.

Definition at line 105 of file manager.cpp.

References e, ERR_CFG, filesystem::istream_file(), game::error::message, and read().

Referenced by refresh_addon_version_info_cache().

config get_addon_pbl_info ( const std::string &  addon_name)

Gets the publish information for an add-on.

Parameters
addon_nameThe add-on's main directory/file name.
Exceptions
invalid_pbl_exceptionIf it is not possible to read the .pbl file (often due to invalid WML).

Definition at line 80 of file manager.cpp.

References e, filesystem::istream_file(), game::error::message, and read().

Referenced by addons_client::delete_remote_addon(), get_addon_tracking_info(), gui2::dialogs::addon_manager::load_addon_list(), and gui2::dialogs::addon_manager::publish_addon().

version_info get_addon_version_info ( const std::string &  addon)

Returns a particular installed add-on's version information.

Definition at line 383 of file manager.cpp.

Referenced by get_addon_tracking_info(), and game_config_manager::load_addons_cfg().

bool have_addon_in_vcs_tree ( const std::string &  addon_name)

Returns true if the specified add-ons appear to be managed by a 'supported' VCS.

Currently supported VCSes are: Subversion, Git, Mercurial.

Definition at line 66 of file manager.cpp.

References filesystem::file_exists(), and filesystem::get_addons_dir().

Referenced by addons_client::do_check_before_overwriting_addon(), get_addon_tracking_info(), refresh_addon_version_info_cache(), and gui2::dialogs::addon_manager::uninstall_addon().

bool have_addon_install_info ( const std::string &  addon_name)

Returns true if there is a local installation info (_info.cfg) file for the add-on.

Definition at line 100 of file manager.cpp.

References filesystem::file_exists().

bool have_addon_pbl_info ( const std::string &  addon_name)

Returns true if there's a local .pbl file stored for the specified add-on.

Definition at line 75 of file manager.cpp.

References filesystem::file_exists().

Referenced by available_addons(), addons_client::do_check_before_overwriting_addon(), get_addon_tracking_info(), refresh_addon_version_info_cache(), and gui2::dialogs::addon_manager::uninstall_addon().

std::vector<std::string> installed_addons ( )

Retrieves the names of all installed add-ons.

Definition at line 148 of file manager.cpp.

References filesystem::file_exists(), filesystem::get_addons_dir(), filesystem::get_files_in_dir(), and i.

Referenced by manage_addons(), refresh_addon_version_info_cache(), and mp::start_client().

bool is_addon_installed ( const std::string &  addon_name)

Check whether the specified add-on is currently installed.

Definition at line 164 of file manager.cpp.

References filesystem::file_exists(), and filesystem::get_addons_dir().

Referenced by addons_client::do_resolve_addon_dependencies(), get_addon_tracking_info(), and addons_client::try_fetch_addon().

void refresh_addon_version_info_cache ( )
bool remove_local_addon ( const std::string &  addon)
void set_addon_pbl_info ( const std::string &  addon_name,
const class config cfg 
)

Sets the publish information for an add-on.

Parameters
addon_nameThe add-on's main directory/file name.
cfgA config object from which the add-on's properties are copied.
void unarchive_addon ( const class config cfg)

Unarchives an add-on from campaignd's retrieved config object.