#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include "../tstring.hpp"
#include "../util.hpp"
Go to the source code of this file.
Namespaces | |
namespace | utils |
Classes | |
class | variable_set |
class | utils::invalid_utf8_exception |
Functions for converting Unicode wide-char strings to UTF-8 encoded strings, back and forth. More... | |
class | utils::utf8_iterator |
Typedefs | |
typedef std::vector< wchar_t > | wide_string |
The type we use to represent Unicode strings. | |
typedef std::vector< Uint16 > | ucs2_string |
typedef std::vector< Uint32 > | ucs4_string |
typedef std::string | utf8_string |
typedef std::map< std::string, t_string > | utils::string_map |
Enumerations | |
enum | { utils::REMOVE_EMPTY = 0x01, utils::STRIP_SPACES = 0x02 } |
Functions | |
bool | utils::isnewline (const char c) |
bool | utils::portable_isspace (const char c) |
bool | utils::notspace (const char c) |
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::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) |
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). | |
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'. | |
bool | utils::string_bool (const std::string &str, bool def) |
bool | utils::word_completion (std::string &text, std::vector< std::string > &wordlist) |
Try to complete the last word of 'text' with the 'wordlist'. | |
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. | |
bool | utils::isvalid_username (const std::string &username) |
Check if the username is valid. | |
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) |
std::string | utils::wstring_to_string (const wide_string &src) |
wide_string | utils::string_to_wstring (const std::string &src) |
std::string | utils::wchar_to_string (const wchar_t c) |
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 *, const utils::string_map &) |
std::string | vngettext (const char *, const char *, int, const utils::string_map &) |
Definition in file string_utils.hpp.
typedef std::vector<Uint16> ucs2_string |
Definition at line 41 of file string_utils.hpp.
typedef std::vector<Uint32> ucs4_string |
Definition at line 42 of file string_utils.hpp.
typedef std::string utf8_string |
Definition at line 43 of file string_utils.hpp.
typedef std::vector<wchar_t> wide_string |
std::string vgettext | ( | const char * | , | |
const utils::string_map & | ||||
) |
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 * | , | |
const char * | , | |||
int | , | |||
const utils::string_map & | ||||
) |
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 |