21 #define GETTEXT_DOMAIN "wesnoth-lib" 31 #define WRN_NG LOG_STREAM(warn, log_engine) 34 #define ERR_WML LOG_STREAM(err, log_wml) 40 ,
const char *
function 41 ,
const std::string& message
42 ,
const std::string& dev_message)
44 std::ostringstream sstr;
46 sstr <<
"Condition '" << cond <<
"' failed at ";
48 sstr <<
"Unconditional failure at ";
51 sstr << file <<
":" << line <<
" in function '" <<
function <<
"'.";
53 if(!dev_message.empty()) {
54 sstr <<
" Extra development information: " << dev_message;
62 std::ostringstream sstr;
66 sstr <<
_(
"An error due to possibly invalid WML occurred\nThe error message is :")
68 <<
_(
"When reporting the bug please include the following error message :")
75 const std::string §ion
76 ,
const std::string &key
77 ,
const std::string& primary_key
78 ,
const std::string& primary_value)
81 if(!section.empty()) {
82 if(section[0] ==
'[') {
83 symbols[
"section"] = section;
86 <<
" parameter 'section' should contain brackets." 88 symbols[
"section"] =
"[" + section +
"]";
92 if(!primary_key.empty()) {
93 assert(!primary_value.empty());
95 symbols[
"primary_key"] = primary_key;
96 symbols[
"primary_value"] = primary_value;
98 return VGETTEXT(
"In section '[$section|]' where '$primary_key| = " 99 "$primary_value' the mandatory key '$key|' isn't set.", symbols);
101 return VGETTEXT(
"In section '[$section|]' the " 102 "mandatory key '$key|' isn't set.", symbols);
107 const std::string& key
108 ,
const std::string& removal_version)
110 assert(!key.empty());
111 assert(!removal_version.empty());
114 symbols[
"key"] = key;
115 symbols[
"removal_version"] = removal_version;
117 return VGETTEXT(
"The key '$key' is deprecated and support " 118 "will be removed in version $removal_version.", symbols);
122 const std::string& deprecated_key
123 ,
const std::string& key
124 ,
const std::string& removal_version)
126 assert(!deprecated_key.empty());
127 assert(!key.empty());
128 assert(!removal_version.empty());
131 symbols[
"deprecated_key"] = deprecated_key;
132 symbols[
"key"] = key;
133 symbols[
"removal_version"] = removal_version;
136 "The key '$deprecated_key' has been renamed to '$key'. " 137 "Support for '$deprecated_key' will be removed in version " 144 ,
const std::string& deprecated_key
145 ,
const std::string& key
146 ,
const std::string& removal_version)
154 result = cfg.
get(deprecated_key);
164 return empty_attribute;
std::map< std::string, t_string > string_map
void throw_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.
Variant for storing WML attributes.
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...
std::string user_message
The message for the user explaining what went wrong.
const attribute_value * get(config_key_type key) const
Returns a pointer to the attribute with the given key or nullptr if it does not exist.
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
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.
static std::string _(const char *str)
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.
void show() const
Shows the error in a dialog.
Helper class, don't construct this directly.
std::string dev_message
The message for developers telling which problem was triggered, this shouldn't be translated...
void line(int from_x, int from_y, int to_x, int to_y)
Draw a line.
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.
Standard logging facilities (interface).
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 show_error_message(const std::string &msg, bool message_use_markup)
Shows an error message to the user.
static lg::log_domain log_wml("wml")
A config object defines a single node in a WML file, with access to child nodes.
std::stringstream & log_to_chat()
Use this to show WML errors in the ingame chat.