The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
addon_utils.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2017 by David White <dave@whitevine.net>
3  2013 - 2015 by Ignacio Riquelme 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 #include <string>
19 
20 class config;
21 
22 namespace campaignd {
23 
24 /**
25  * Markup characters recognized by GUI1 code.
26  *
27  * These must be the same as the constants defined in marked-up_text.cpp.
28  */
30 
31 inline bool is_text_markup_char(char c)
32 {
33  return illegal_markup_chars.find(c) != std::string::npos;
34 }
35 
36 /**
37  * Format a feedback URL for an add-on.
38  *
39  * @param format The format string for the URL, presumably obtained
40  * from the add-ons server identification.
41  *
42  * @param params The URL format parameters table.
43  *
44  * @return A string containing a feedback URL or an empty string if that
45  * is not possible (e.g. empty or invalid @a format, empty
46  * @a params table, or a result that is identical in content to
47  * the @a format suggesting that the @a params table contains
48  * incorrect data).
49  */
51 
52 
53 /**
54  * Scans an add-on archive directory for translations.
55  *
56  * Any subdirectories of @a base_dir containing a subdirectory named
57  * 'LC_MESSAGES' are assumed to be translation dirs. The names of the
58  * subdirectories thus located are recorded into the @a addon WML node in
59  * [translation] children nodes like the following (comments included for
60  * documentation purposes):
61  *
62  * @verbatim
63  * [translation]
64  * language="es" # translations/es/LC_MESSAGES/
65  * [/translation]
66  * [translation]
67  * language="ja" # translations/ja/LC_MESSAGES/
68  * [/translation]
69  * @endverbatim
70  */
71 void find_translations(const config& base_dir, config& addon);
72 
73 /**
74  * Adds a COPYING.txt file with the full text of the GNU GPL to an add-on.
75  *
76  * This only has an effect if the add-on archive @a cfg does not already
77  * contain an equivalent file ('copying.txt', 'COPYING', etc.).
78  */
79 void add_license(config& cfg);
80 
81 }
std::vector< char_t > string
void add_license(config &cfg)
Adds a COPYING.txt file with the full text of the GNU GPL to an add-on.
bool is_text_markup_char(char c)
Definition: addon_utils.hpp:31
void find_translations(const config &base_dir, config &addon)
Scans an add-on archive directory for translations.
Definition: addon_utils.cpp:95
const std::string illegal_markup_chars
Markup characters recognized by GUI1 code.
Definition: addon_utils.cpp:61
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:93
mock_char c
std::string format_addon_feedback_url(const std::string &format, const config &params)
Format a feedback URL for an add-on.
Definition: addon_utils.cpp:63