The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
manager.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2008 by David White <dave@whitevine.net>
3  2008 - 2015 by Ignacio R. Morelle <shadowm2006@gmail.com>
4  Part of the Battle for Wesnoth Project http://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 class config;
19 class version_info;
20 
21 #include "addon/validation.hpp"
22 
23 #include <string>
24 #include <vector>
25 #include <utility>
26 
27 /**
28  * Exception thrown when the WML parser fails to read a .pbl file.
29  */
31 {
32  /**
33  * Constructor.
34  *
35  * @param pbl_path Path to the faulty .pbl file.
36  * @param msg An error message to display.
37  */
39  : path(pbl_path), message(msg)
40  {}
41 
42  /** Path to the faulty .pbl file. */
44 
45  /** Error message to display. */
47 };
48 
49 bool remove_local_addon(const std::string& addon);
50 
51 /**
52  * Returns true if there's a local .pbl file stored for the specified add-on.
53  */
54 bool have_addon_pbl_info(const std::string& addon_name);
55 
56 /**
57  * Returns true if the specified add-ons appear to be managed by a 'supported' VCS.
58  *
59  * Currently supported VCSes are: Subversion, Git, Mercurial.
60  */
61 bool have_addon_in_vcs_tree(const std::string& addon_name);
62 
63 /**
64  * Gets the publish information for an add-on.
65  *
66  * @param addon_name The add-on's main directory/file name.
67  *
68  * @exception invalid_pbl_exception If it is not possible to read the .pbl file
69  * (often due to invalid WML).
70  */
71 config get_addon_pbl_info(const std::string& addon_name);
72 
73 /**
74  * Sets the publish information for an add-on
75  *
76  * @param addon_name The add-on's main directory/file name.
77  * @param cfg A config object from which the add-on's
78  * properties are copied.
79  */
80 void set_addon_pbl_info(const std::string& addon_name, const class config& cfg);
81 
82 /**
83  * Returns true if there is a local installation info (_info.cfg) file for the add-on.
84  */
85 bool have_addon_install_info(const std::string& addon_name);
86 
87 /**
88  * Gets the installation info (_info.cfg) for an add-on.
89  *
90  * @param addon_name The add-on's main directory/file name.
91  * @param cfg A config object to store the add-on's
92  * properties.
93  */
94 void get_addon_install_info(const std::string& addon_name, class config& cfg);
95 
96 /** Returns a list of local add-ons that can be published. */
97 std::vector<std::string> available_addons();
98 
99 /** Retrieves the names of all installed add-ons. */
100 std::vector<std::string> installed_addons();
101 
102 /** Check whether the specified add-on is currently installed. */
103 bool is_addon_installed(const std::string& addon_name);
104 
105 /** Archives an add-on into a config object for campaignd transactions. */
106 void archive_addon(const std::string& addon_name, class config& cfg);
107 
108 /** Unarchives an add-on from campaignd's retrieved config object. */
109 void unarchive_addon(const class config& cfg);
110 
111 /** Refreshes the per-session cache of add-on's version information structs. */
113 
114 /** Returns a particular installed add-on's version information. */
std::vector< std::string > available_addons()
Returns a list of local add-ons that can be published.
Definition: manager.cpp:132
std::vector< char_t > string
invalid_pbl_exception(const std::string &pbl_path, const std::string &msg)
Constructor.
Definition: manager.hpp:38
void refresh_addon_version_info_cache()
Refreshes the per-session cache of add-on's version information structs.
Definition: manager.cpp:341
const std::string path
Path to the faulty .pbl file.
Definition: manager.hpp:43
void set_addon_pbl_info(const std::string &addon_name, const class config &cfg)
Sets the publish information for an add-on.
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.
Definition: manager.cpp:66
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: manager.cpp:100
Exception thrown when the WML parser fails to read a .pbl file.
Definition: manager.hpp:30
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: manager.cpp:75
bool remove_local_addon(const std::string &addon)
Definition: manager.cpp:118
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:110
void archive_addon(const std::string &addon_name, class config &cfg)
Archives an add-on into a config object for campaignd transactions.
Definition: manager.cpp:298
const std::string message
Error message to display.
Definition: manager.hpp:46
bool is_addon_installed(const std::string &addon_name)
Check whether the specified add-on is currently installed.
Definition: manager.cpp:164
void unarchive_addon(const class config &cfg)
Unarchives an add-on from campaignd's retrieved config object.
version_info get_addon_version_info(const std::string &addon)
Returns a particular installed add-on's version information.
Definition: manager.cpp:383
Represents version numbers.
Definition: version.hpp:43
void get_addon_install_info(const std::string &addon_name, class config &cfg)
Gets the installation info (_info.cfg) for an add-on.
Definition: manager.cpp:105
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
std::vector< std::string > installed_addons()
Retrieves the names of all installed add-ons.
Definition: manager.cpp:148
config get_addon_pbl_info(const std::string &addon_name)
Gets the publish information for an add-on.
Definition: manager.cpp:80