The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
validation.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_VALIDATION_HPP_INCLUDED
17 #define ADDON_VALIDATION_HPP_INCLUDED
18 
19 #include <vector>
20 #include <string>
21 
22 class config;
23 
24 /**
25  * Default port number for the addon server.
26  *
27  * @note This might not be the best place to declare the variable, but it's
28  * one of the few files shared by the server and the game.
29  */
30 extern const unsigned short default_campaignd_port;
31 
32 /**
33  * Values used for add-on classification; UI-only
34  * at the moment, in the future it could be used for
35  * directory allocation too, removing the need for
36  * the ADDON_GROUP constants (TODO).
37  *
38  * @note If you change the order or content of these, you'll also need
39  * to update the @a addon_type_strings table found in validation.cpp.
40  */
41 enum ADDON_TYPE {
42  ADDON_UNKNOWN, /**< a.k.a. anything. */
43  ADDON_CORE, /**< Total Conversion Core. */
44  ADDON_SP_CAMPAIGN, /**< Single-player campaign. */
45  ADDON_SP_SCENARIO, /**< Single-player scenario. */
46  ADDON_SP_MP_CAMPAIGN, /**< Hybrid campaign. */
47  ADDON_MP_CAMPAIGN, /**< Multiplayer campaign. */
48  ADDON_MP_SCENARIO, /**< Multiplayer scenario. */
49  ADDON_MP_MAPS, /**< Multiplayer plain (no WML) map pack. */
50  ADDON_MP_ERA, /**< Multiplayer era. */
51  ADDON_MP_FACTION, /**< Multiplayer faction. */
52  // NOTE: following two still require proper engine support
53  ADDON_MP_MOD, /**< Modification of the game for MP. */
54  //ADDON_GUI, // GUI add-ons/themes.
55  ADDON_MEDIA, /**< Miscellaneous content/media (unit packs, terrain packs, music packs, etc.). */
56  ADDON_OTHER, /**< an add-on that fits in no other category */
58 };
59 
62 
63 /** Checks whether an add-on id/name is legal or not. */
64 bool addon_name_legal(const std::string& name);
65 /** Checks whether an add-on file name is legal or not. */
67 /** Probes an add-on archive for illegal names. */
68 bool check_names_legal(const config& dir);
69 
72 bool needs_escaping(char c);
73 
74 #endif /* !ADDON_CHECKS_HPP_INCLUDED */
Single-player scenario.
Definition: validation.hpp:45
ADDON_TYPE get_addon_type(const std::string &str)
Definition: validation.cpp:82
ADDON_TYPE
Values used for add-on classification; UI-only at the moment, in the future it could be used for dire...
Definition: validation.hpp:41
an add-on that fits in no other category
Definition: validation.hpp:56
Total Conversion Core.
Definition: validation.hpp:43
const GLfloat * c
Definition: glew.h:12741
bool addon_name_legal(const std::string &name)
Checks whether an add-on id/name is legal or not.
Definition: validation.cpp:48
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
bool needs_escaping(char c)
Definition: validation.cpp:108
const unsigned short default_campaignd_port
Default port number for the addon server.
Definition: validation.cpp:20
Multiplayer faction.
Definition: validation.hpp:51
std::string encode_binary(const std::string &str)
Definition: validation.cpp:120
bool check_names_legal(const config &dir)
Probes an add-on archive for illegal names.
Definition: validation.cpp:70
std::string get_addon_type_string(ADDON_TYPE type)
Definition: validation.cpp:98
Modification of the game for MP.
Definition: validation.hpp:53
Miscellaneous content/media (unit packs, terrain packs, music packs, etc.).
Definition: validation.hpp:55
Multiplayer scenario.
Definition: validation.hpp:48
Multiplayer era.
Definition: validation.hpp:50
Multiplayer plain (no WML) map pack.
Definition: validation.hpp:49
GLuint const GLchar * name
Definition: glew.h:1782
std::string unencode_binary(const std::string &str)
Definition: validation.cpp:138
Hybrid campaign.
Definition: validation.hpp:46
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
bool addon_filename_legal(const std::string &name)
Checks whether an add-on file name is legal or not.
Definition: validation.cpp:59
Single-player campaign.
Definition: validation.hpp:44
GLsizei const GLcharARB ** string
Definition: glew.h:4503
Multiplayer campaign.
Definition: validation.hpp:47