#include "global.hpp"
#include <cctype>
#include <sstream>
#include "gettext.hpp"
#include "util.hpp"
#include "log.hpp"
#include "serialization/string_utils.hpp"
#include "wctype.h"
Go to the source code of this file.
Namespaces | |
namespace | utils |
Classes | |
class | utils::string_map_variable_set |
Defines | |
#define | ERR_GENERAL LOG_STREAM(err, general) |
Functions | |
static bool | two_dots (char a, char b) |
static std::string | do_interpolation (const std::string &str, const variable_set &set) |
bool | utils::isnewline (const char c) |
bool | utils::portable_isspace (const char c) |
bool | utils::notspace (const char c) |
std::string & | utils::strip (std::string &str) |
Remove whitespace from the front and back of the string 'str'. | |
std::string & | utils::strip_char (std::string &str, const char c) |
Removes character 'c' from the first and last position of the string 'str'. | |
std::vector< std::string > | utils::split (std::string const &val, char c, int flags) |
std::vector< std::string > | utils::paranthetical_split (std::string const &val, const char separator, std::string const &left, std::string const &right, int flags) |
Splits a string based either on a separator where text within paranthesis is protected from splitting (Note that one can use the same character for both the left and right paranthesis. | |
std::string | utils::interpolate_variables_into_string (const std::string &str, const string_map *const symbols) |
Function which will interpolate variables, starting with '$' in the string 'str' with the equivalent symbols in the given symbol table. | |
std::string | utils::interpolate_variables_into_string (const std::string &str, const variable_set &variables) |
int | utils::apply_modifier (const int number, const std::string &amount, const int minimum) |
std::string & | utils::escape (std::string &str, const std::string &special_chars) |
Prepends a configurable set of characters with a backslash. | |
std::string & | utils::escape (std::string &str) |
Prepend all special characters with a backslash. | |
std::string & | utils::unescape (std::string &str) |
Remove all escape characters (backslash). | |
bool | utils::string_bool (const std::string &str, bool def) |
static bool | utils::is_username_char (char c) |
bool | utils::isvalid_username (const std::string &username) |
Check if the username is valid. | |
bool | utils::word_completion (std::string &text, std::vector< std::string > &wordlist) |
Try to complete the last word of 'text' with the 'wordlist'. | |
static bool | utils::is_word_boundary (char c) |
bool | utils::word_match (const std::string &message, const std::string &word) |
Check if a string contains a word. | |
bool | utils::wildcard_string_match (const std::string &str, const std::string &match) |
Match using '*' as any number of characters (including none), and '?' as any one character. | |
std::string | utils::join (std::vector< std::string > const &v, char c) |
std::vector< std::string > | utils::quoted_split (std::string const &val, char c, int flags, char quote) |
std::pair< int, int > | utils::parse_range (std::string const &str) |
std::vector< std::pair< int, int > > | utils::parse_ranges (std::string const &str) |
static int | utils::byte_size_from_utf8_first (unsigned char ch) |
std::string | utils::wstring_to_string (const wide_string &src) |
std::string | utils::wchar_to_string (const wchar_t c) |
wide_string | utils::string_to_wstring (const std::string &src) |
utf8_string | utils::capitalize (const utf8_string &) |
Returns a version of the string with the first letter capitalized. | |
utf8_string | utils::uppercase (const utf8_string &) |
Returns an uppercased version of the string. | |
utf8_string | utils::lowercase (const utf8_string &) |
Returns a lowercased version of the string. | |
void | utils::truncate_as_wstring (std::string &str, const size_t size) |
Truncates a string. | |
std::string | vgettext (const char *msgid, const utils::string_map &symbols) |
std::string | vngettext (const char *sing, const char *plur, int n, const utils::string_map &symbols) |
Definition in file string_utils.cpp.
#define ERR_GENERAL LOG_STREAM(err, general) |
Definition at line 30 of file string_utils.cpp.
Referenced by utils::paranthetical_split(), utils::string_to_wstring(), and utils::wstring_to_string().
static std::string do_interpolation | ( | const std::string & | str, | |
const variable_set & | set | |||
) | [static] |
Definition at line 38 of file string_utils.cpp.
References variable_set::get_variable_const(), and two_dots().
Referenced by utils::interpolate_variables_into_string().
static bool two_dots | ( | char | a, | |
char | b | |||
) | [static] |
Definition at line 36 of file string_utils.cpp.
std::string vgettext | ( | const char * | msgid, | |
const utils::string_map & | symbols | |||
) |
Definition at line 893 of file string_utils.cpp.
References _, and utils::interpolate_variables_into_string().
Referenced by unit::add_modification(), events::chat_handler::change_logging(), mp::create::create(), events::console_handler::do_control(), events::console_handler::do_droid(), events::menu_handler::do_search(), get_player_info(), image::getMinimap(), gui2::tgui_definition::load_definitions(), mp::connect::load_game(), missing_mandatory_wml_key(), move_unit(), open_connection(), turn_info::process_network_data(), gamemap::read(), mp::connect::side::resolve_random(), events::menu_handler::save_map(), map_editor::save_map(), and mp::gamebrowser::set_game_items().
std::string vngettext | ( | const char * | sing, | |
const char * | plur, | |||
int | n, | |||
const utils::string_map & | symbols | |||
) |
Definition at line 900 of file string_utils.cpp.
References _n, and utils::interpolate_variables_into_string().
Referenced by check_timeout(), move_unit(), events::menu_handler::recall(), and playsingle_controller::report_victory().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |