The Battle for Wesnoth  1.15.0-dev
Classes | Namespaces | Macros | Functions | Variables
string_utils.cpp File Reference
#include "formula/string_utils.hpp"
#include "config.hpp"
#include "log.hpp"
#include "gettext.hpp"
Include dependency graph for string_utils.cpp:

Go to the source code of this file.

Classes

class  utils::string_map_variable_set< T >
 

Namespaces

 utils
 
 utils::detail
 

Macros

#define GETTEXT_DOMAIN   "wesnoth-lib"
 
#define ERR_NG   LOG_STREAM(err, log_engine)
 
#define WRN_NG   LOG_STREAM(warn, log_engine)
 

Functions

static bool two_dots (char a, char b)
 
static std::string do_interpolation (const std::string &str, const variable_set &set)
 
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. More...
 
std::string utils::interpolate_variables_into_string (const std::string &str, const std::map< std::string, std::string > *const symbols)
 
std::string utils::interpolate_variables_into_string (const std::string &str, const variable_set &variables)
 
t_string utils::interpolate_variables_into_tstring (const t_string &str, const variable_set &variables)
 Function that does the same as the above, for t_stringS. More...
 
std::string utils::format_conjunct_list (const t_string &empty, const std::vector< t_string > &elems)
 Format a conjunctive list. More...
 
std::string utils::format_disjunct_list (const t_string &empty, const std::vector< t_string > &elems)
 Format a disjunctive list. More...
 
std::string vgettext (const char *msgid, const utils::string_map &symbols)
 
std::string vgettext (const char *domain, const char *msgid, const utils::string_map &symbols)
 
std::string vngettext (const char *sing, const char *plur, int n, const utils::string_map &symbols)
 
std::string vngettext (const char *domain, const char *sing, const char *plur, int n, const utils::string_map &symbols)
 

Variables

static lg::log_domain log_engine ("engine")
 
std::string(* utils::detail::evaluate_formula )(const std::string &formula) = nullptr
 

Macro Definition Documentation

◆ ERR_NG

#define ERR_NG   LOG_STREAM(err, log_engine)

Definition at line 25 of file string_utils.cpp.

Referenced by do_interpolation().

◆ GETTEXT_DOMAIN

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 16 of file string_utils.cpp.

◆ WRN_NG

#define WRN_NG   LOG_STREAM(warn, log_engine)

Definition at line 26 of file string_utils.cpp.

Referenced by do_interpolation().

Function Documentation

◆ do_interpolation()

static std::string do_interpolation ( const std::string &  str,
const variable_set set 
)
static

the default value is specified after ''?'

Definition at line 56 of file string_utils.cpp.

References c, config_attribute_value::empty(), ERR_NG, utils::detail::evaluate_formula, two_dots(), and WRN_NG.

Referenced by utils::interpolate_variables_into_string().

◆ two_dots()

static bool two_dots ( char  a,
char  b 
)
static

Definition at line 28 of file string_utils.cpp.

Referenced by do_interpolation().

◆ vgettext() [1/2]

std::string vgettext ( const char *  msgid,
const utils::string_map symbols 
)

Definition at line 284 of file string_utils.cpp.

References _(), utils::interpolate_variables_into_string(), and wfl::msg().

◆ vgettext() [2/2]

std::string vgettext ( const char *  domain,
const char *  msgid,
const utils::string_map symbols 
)

◆ vngettext() [1/2]

std::string vngettext ( const char *  sing,
const char *  plur,
int  n,
const utils::string_map symbols 
)

Definition at line 299 of file string_utils.cpp.

References _n(), utils::interpolate_variables_into_string(), and wfl::msg().

◆ vngettext() [2/2]

std::string vngettext ( const char *  domain,
const char *  sing,
const char *  plur,
int  n,
const utils::string_map symbols 
)

Variable Documentation

◆ log_engine

lg::log_domain log_engine("engine")
static