The Battle for Wesnoth  1.13.4+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 <[email protected]>
3  2008 - 2015 by Ignacio R. Morelle <[email protected]>
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 #ifndef ADDON_MANAGER_HPP_INCLUDED
17 #define ADDON_MANAGER_HPP_INCLUDED
18 
19 class config;
20 class version_info;
21 
22 #include "addon/validation.hpp"
23 
24 #include <string>
25 #include <vector>
26 #include <utility>
27 
28 /**
29  * Exception thrown when the WML parser fails to read a .pbl file.
30  */
32 {
33  /**
34  * Constructor.
35  *
36  * @param pbl_path Path to the faulty .pbl file.
37  * @param msg An error message to display.
38  */
40  : path(pbl_path), message(msg)
41  {}
42 
43  /** Path to the faulty .pbl file. */
45 
46  /** Error message to display. */
48 };
49 
50 bool remove_local_addon(const std::string& addon);
51 
52 /**
53  * Returns true if there's a local .pbl file stored for the specified add-on.
54  */
55 bool have_addon_pbl_info(const std::string& addon_name);
56 
57 /**
58  * Returns true if the specified add-ons appear to be managed by a 'supported' VCS.
59  *
60  * Currently supported VCSes are: Subversion, Git, Mercurial.
61  */
62 bool have_addon_in_vcs_tree(const std::string& addon_name);
63 
64 /**
65  * Gets the publish information for an add-on.
66  *
67  * @param addon_name The add-on's main directory/file name.
68  * @param cfg A config object to store the add-on's
69  * properties.
70  *
71  * @exception invalid_pbl_exception If it is not possible to read the .pbl file
72  * (often due to invalid WML).
73  */
74 void get_addon_pbl_info(const std::string& addon_name, class config& cfg);
75 
76 /**
77  * Sets the publish information for an add-on
78  *
79  * @param addon_name The add-on's main directory/file name.
80  * @param cfg A config object from which the add-on's
81  * properties are copied.
82  */
83 void set_addon_pbl_info(const std::string& addon_name, const class config& cfg);
84 
85 /**
86  * Returns true if there is a local installation info (_info.cfg) file for the add-on.
87  */
88 bool have_addon_install_info(const std::string& addon_name);
89 
90 /**
91  * Gets the installation info (_info.cfg) for an add-on.
92  *
93  * @param addon_name The add-on's main directory/file name.
94  * @param cfg A config object to store the add-on's
95  * properties.
96  */
97 void get_addon_install_info(const std::string& addon_name, class config& cfg);
98 
99 /** Returns a list of local add-ons that can be published. */
100 std::vector<std::string> available_addons();
101 
102 /** Retrieves the names of all installed add-ons. */
103 std::vector<std::string> installed_addons();
104 
105 /** Check whether the specified add-on is currently installed. */
106 bool is_addon_installed(const std::string& addon_name);
107 
108 /** Archives an add-on into a config object for campaignd transactions. */
109 void archive_addon(const std::string& addon_name, class config& cfg);
110 
111 /** Unarchives an add-on from campaignd's retrieved config object. */
112 void unarchive_addon(const class config& cfg);
113 
114 /** Refreshes the per-session cache of add-on's version information structs. */
116 
117 /** Returns a particular installed add-on's version information. */
119 
120 #endif /* !ADDON_MANAGEMENT_HPP_INCLUDED */
std::vector< std::string > available_addons()
Returns a list of local add-ons that can be published.
Definition: manager.cpp:134
invalid_pbl_exception(const std::string &pbl_path, const std::string &msg)
Constructor.
Definition: manager.hpp:39
void refresh_addon_version_info_cache()
Refreshes the per-session cache of add-on's version information structs.
Definition: manager.cpp:337
const std::string path
Path to the faulty .pbl file.
Definition: manager.hpp:44
void get_addon_pbl_info(const std::string &addon_name, class config &cfg)
Gets the publish information for an add-on.
Definition: manager.cpp:85
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:71
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:102
Exception thrown when the WML parser fails to read a .pbl file.
Definition: manager.hpp:31
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:80
bool remove_local_addon(const std::string &addon)
Definition: manager.cpp:120
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:294
GLsizei const char ** path
Definition: glew.h:4654
const std::string message
Error message to display.
Definition: manager.hpp:47
bool is_addon_installed(const std::string &addon_name)
Check whether the specified add-on is currently installed.
Definition: manager.cpp:166
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:379
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
Definition: debugger.cpp:112
Represents version numbers.
Definition: version.hpp:44
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499
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:107
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
std::vector< std::string > installed_addons()
Retrieves the names of all installed add-ons.
Definition: manager.cpp:150
GLsizei const GLcharARB ** string
Definition: glew.h:4503