20 #define GETTEXT_DOMAIN "wesnoth-lib"
31 #define WRN_NG LOG_STREAM(warn, log_engine)
37 ,
const char *
function
41 std::ostringstream sstr;
43 sstr <<
"Condition '" << cond <<
"' failed at ";
45 sstr <<
"Unconditional failure at ";
48 sstr << file <<
":" << line <<
" in function '" <<
function <<
"'.";
50 if(!dev_message.empty()) {
51 sstr <<
" Extra development information: " << dev_message;
59 std::ostringstream sstr;
63 sstr <<
_(
"An error due to possibly invalid WML occurred\nThe error message is :")
65 <<
_(
"When reporting the bug please include the following error message :")
78 if(!section.empty()) {
79 if(section[0] ==
'[') {
80 symbols[
"section"] = section;
83 <<
" parameter 'section' should contain brackets."
85 symbols[
"section"] =
"[" + section +
"]";
89 if(!primary_key.empty()) {
90 assert(!primary_value.empty());
92 symbols[
"primary_key"] = primary_key;
93 symbols[
"primary_value"] = primary_value;
95 return vgettext(
"In section '[$section|]' where '$primary_key| = "
96 "$primary_value' the mandatory key '$key|' isn't set.", symbols);
98 return vgettext(
"In section '[$section|]' the "
99 "mandatory key '$key|' isn't set.", symbols);
107 assert(!key.empty());
108 assert(!removal_version.empty());
111 symbols[
"key"] = key;
112 symbols[
"removal_version"] = removal_version;
114 return vgettext(
"The key '$key' is deprecated and support "
115 "will be removed in version $removal_version.", symbols);
123 assert(!deprecated_key.empty());
124 assert(!key.empty());
125 assert(!removal_version.empty());
128 symbols[
"deprecated_key"] = deprecated_key;
129 symbols[
"key"] = key;
130 symbols[
"removal_version"] = removal_version;
133 "The key '$deprecated_key' has been renamed to '$key'. "
134 "Support for '$deprecated_key' will be removed in version "
151 result = cfg.
get(deprecated_key);
164 return empty_attribute;
void show_error_message(CVideo &video, const std::string &message, bool message_use_markup)
Shows an error message to the user.
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
void show(CVideo &video)
Shows the error in a dialog.
const config::attribute_value & get_renamed_config_attribute(const config &cfg, const std::string &deprecated_key, const std::string &key, const std::string &removal_version)
Returns a config attribute, using either the old name or the new one.
Variant for storing WML attributes.
std::string missing_mandatory_wml_key(const std::string §ion, const std::string &key, const std::string &primary_key, const std::string &primary_value)
Returns a standard message for a missing wml key.
std::string user_message
The message for the user explaining what went wrong.
static UNUSEDNOWARN std::string _(const char *str)
std::map< std::string, t_string > string_map
std::string dev_message
The message for developers telling which problem was triggered, this shouldn't be translated...
std::stringstream & wml_error()
Use this logger to send errors due to deprecated WML.
static lg::log_domain log_engine("engine")
std::string deprecated_renamed_wml_key_warning(const std::string &deprecated_key, const std::string &key, const std::string &removal_version)
Returns a standard warning message for using a deprecated renamed wml key.
const attribute_value * get(const std::string &key) const
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
static int cond(LexState *ls)
Standard logging facilities (interface).
GLsizei GLenum GLuint GLuint GLsizei char * message
std::string deprecate_wml_key_warning(const std::string &key, const std::string &removal_version)
Returns a standard warning message for using a deprecated wml key.
void wml_exception(const char *cond, const char *file, const int line, const char *function, const std::string &message, const std::string &dev_message)
Helper function, don't call this directly.
A config object defines a single node in a WML file, with access to child nodes.
Helper class, don't construct this directly.
GLsizei const GLcharARB ** string