Implementation for wml_exception.hpp. More...
#include "global.hpp"
#include "wml_exception.hpp"
#include "gettext.hpp"
#include "gui/dialogs/message.hpp"
#include "formula/string_utils.hpp"
#include "log.hpp"
Go to the source code of this file.
Macros | |
#define | GETTEXT_DOMAIN "wesnoth-lib" |
#define | WRN_NG LOG_STREAM(warn, log_engine) |
Functions | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Variables | |
static lg::log_domain | log_engine ("engine") |
Implementation for wml_exception.hpp.
Definition in file wml_exception.cpp.
#define GETTEXT_DOMAIN "wesnoth-lib" |
Definition at line 20 of file wml_exception.cpp.
#define WRN_NG LOG_STREAM(warn, log_engine) |
Definition at line 31 of file wml_exception.cpp.
Referenced by missing_mandatory_wml_key().
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.
key | The deprecated key. |
removal_version | The version in which the key will be removed key. |
Definition at line 103 of file wml_exception.cpp.
References vgettext().
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.
deprecated_key | The deprecated key. |
key | The new key to be used. |
removal_version | The version in which the key will be removed key. |
Definition at line 118 of file wml_exception.cpp.
References vgettext().
Referenced by get_renamed_config_attribute().
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.
The function first tries the find the attribute using key
and if that doesn't find the attribute it tries deprecated_key
. If that test finds an attribute it will issue a warning and return the result. Else returns an empty attribute.
cfg | The config to get the attribute from. |
deprecated_key | The deprecated key. |
key | The new key to be used. |
removal_version | The version in which the key will be removed key. |
Definition at line 139 of file wml_exception.cpp.
References deprecated_renamed_wml_key_warning(), config::get(), and lg::wml_error().
std::string missing_mandatory_wml_key | ( | const std::string & | section, |
const std::string & | key, | ||
const std::string & | primary_key = "" , |
||
const std::string & | primary_value = "" |
||
) |
Returns a standard message for a missing wml key.
section | The section is which the key should appear (this should include the section brackets). It may contain parent sections to make it easier to find the wanted sections. They are listed like [parent][child][section]. |
key | The omitted key. |
primary_key | The primary key of the section. |
primary_value | The value of the primary key (mandatory if primary key isn't empty). |
Definition at line 71 of file wml_exception.cpp.
References vgettext(), and WRN_NG.
Referenced by expand_partialresolution(), gui2::tgui_definition::read(), gui2::twindow_builder::read(), gui2::tcontrol_definition::tcontrol_definition(), terrain_type::terrain_type(), gui2::tvertical_scrollbar_definition::tresolution::tresolution(), gui2::thorizontal_scrollbar_definition::tresolution::tresolution(), gui2::twindow_builder::tresolution::tresolution(), gui2::tslider_definition::tresolution::tresolution(), gui2::twindow_builder::tresolution::ttip::ttip(), and gui2::implementation::ttree_node::ttree_node().
void wml_exception | ( | const char * | cond, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
const std::string & | message, | ||
const std::string & | dev_message = "" |
||
) |
Helper function, don't call this directly.
cond | The textual presentation of the test that failed. |
file | The file in which the test failed. |
line | The line at which the test failed. |
function | The function in which the test failed. |
message | The translated message to show the user. |
Definition at line 33 of file wml_exception.cpp.
|
static |