The Battle for Wesnoth  1.13.4+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 - 2016 by David White <[email protected]>
3  2013 - 2015 by Ignacio Riquelme 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 CAMPAIGN_SERVER_ADDON_UTILS_HPP_INCLUDED
17 #define CAMPAIGN_SERVER_ADDON_UTILS_HPP_INCLUDED
18 
19 #include <string>
20 
21 class config;
22 
23 namespace campaignd {
24 
25 /**
26  * Markup characters recognized by GUI1 code.
27  *
28  * These must be the same as the constants defined in marked-up_text.cpp.
29  */
31 
32 inline bool is_text_markup_char(char c)
33 {
34  return illegal_markup_chars.find(c) != std::string::npos;
35 }
36 
37 /**
38  * Format a feedback URL for an add-on.
39  *
40  * @param format The format string for the URL, presumably obtained
41  * from the add-ons server identification.
42  *
43  * @param params The URL format parameters table.
44  *
45  * @return A string containing a feedback URL or an empty string if that
46  * is not possible (e.g. empty or invalid @a format, empty
47  * @a params table, or a result that is identical in content to
48  * the @a format suggesting that the @a params table contains
49  * incorrect data).
50  */
52 
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 
84 #endif
const GLfloat * c
Definition: glew.h:12741
const GLfloat * params
Definition: glew.h:1499
void add_license(config &cfg)
Adds a COPYING.txt file with the full text of the GNU GPL to an add-on.
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1222
bool is_text_markup_char(char c)
Definition: addon_utils.hpp:32
void find_translations(const config &base_dir, config &addon)
Scans an add-on archive directory for translations.
Definition: addon_utils.cpp:93
const std::string illegal_markup_chars
Markup characters recognized by GUI1 code.
Definition: addon_utils.cpp:59
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
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:61
GLsizei const GLcharARB ** string
Definition: glew.h:4503