1 /*
2    Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
3                  2013 - 2015 by Iris Morelle <shadowm2006@gmail.com>
4    Part of the Battle for Wesnoth Project https://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  */
29 extern const std::string illegal_markup_chars;
30 
is_text_markup_char(char c)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  */
50 std::string format_addon_feedback_url(const std::string& format, const config& params);
51 
52 void support_translation(config& addon, const std::string& locale_id);
53 
54 /**
55  * Scans an add-on archive directory for translations.
56  *
57  * Any subdirectories of @a base_dir containing a subdirectory named
58  * 'LC_MESSAGES' are assumed to be translation dirs. The names of the
59  * subdirectories thus located are recorded into the @a addon WML node in
60  * [translation] children nodes like the following (comments included for
61  * documentation purposes):
62  *
63  * @verbatim
64  *     [translation]
65  *         language="es" # translations/es/LC_MESSAGES/
66  *     [/translation]
67  *     [translation]
68  *         language="ja" # translations/ja/LC_MESSAGES/
69  *     [/translation]
70  * @endverbatim
71  */
72 void find_translations(const config& base_dir, config& addon);
73 
74 /**
75  * Adds a COPYING.txt file with the full text of the GNU GPL to an add-on.
76  *
77  * This only has an effect if the add-on archive @a cfg does not already
78  * contain an equivalent file ('copying.txt', 'COPYING', etc.).
79  */
80 void add_license(config& cfg);
81 
82 }
83