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 symbols[
"section"] = section;
83 if(!primary_key.empty()) {
84 assert(!primary_value.empty());
86 symbols[
"primary_key"] = primary_key;
87 symbols[
"primary_value"] = primary_value;
89 return VGETTEXT(
"In section ‘[$section|]’ where ‘$primary_key|’ = "
90 "‘$primary_value’ the mandatory key ‘$key|’ isn’t set.", symbols);
92 return VGETTEXT(
"In section ‘[$section|]’ the "
93 "mandatory key ‘$key|’ isn’t set.", symbols);
98 const std::string §ion
99 ,
const std::string &
tag)
102 symbols[
"section"] = section;
103 symbols[
"tag"] =
tag;
104 return VGETTEXT(
"In section ‘[$section|]’ the "
105 "mandatory subtag ‘[$tag|]’ is missing.", symbols);
static std::string _(const char *str)
Standard logging facilities (interface).
void line(int from_x, int from_y, int to_x, int to_y)
Draw a line.
void show_error_message(const std::string &msg, bool message_use_markup)
Shows an error message to the user.
std::string tag(const std::string &tag_name, Args &&... contents)
Returns the contents enclosed inside <tag_name> and </tag_name>
std::map< std::string, t_string > string_map
Helper class, don't construct this directly.
void show() const
Shows the error in a dialog.
std::string dev_message
The message for developers telling which problem was triggered, this shouldn't be translated.
std::string user_message
The message for the user explaining what went wrong.
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.
static lg::log_domain log_engine("engine")
std::string missing_mandatory_wml_tag(const std::string §ion, const std::string &tag)
Returns a standard message for a missing wml child (tag).
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 (attribute).
static lg::log_domain log_wml("wml")
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that...