Add a special kind of assert to validate whether the input from WML doesn't contain any problems that might crash the game. More...
Go to the source code of this file.
Classes | |
struct | wml_exception |
Helper class, don't construct this directly. More... | |
Macros | |
#define | VALIDATE(cond, message) |
The macro to use for the validation of WML. More... | |
#define | VALIDATE_WML_CHILD(cfg, key, message) |
#define | VALIDATE_WITH_DEV_MESSAGE(cond, message, dev_message) |
#define | FAIL(message) |
#define | FAIL_WITH_DEV_MESSAGE(message, dev_message) |
Functions | |
void | throw_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. 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... | |
Add a special kind of assert to validate whether the input from WML doesn't contain any problems that might crash the game.
Definition in file wml_exception.hpp.
#define FAIL | ( | message | ) |
Definition at line 65 of file wml_exception.hpp.
#define FAIL_WITH_DEV_MESSAGE | ( | message, | |
dev_message | |||
) |
Definition at line 70 of file wml_exception.hpp.
#define VALIDATE | ( | cond, | |
message | |||
) |
The macro to use for the validation of WML.
cond | The condition to test, if false and exception is generated. |
message | The translatable message to show at the user. |
Definition at line 40 of file wml_exception.hpp.
#define VALIDATE_WITH_DEV_MESSAGE | ( | cond, | |
message, | |||
dev_message | |||
) |
Definition at line 53 of file wml_exception.hpp.
#define VALIDATE_WML_CHILD | ( | cfg, | |
key, | |||
message | |||
) |
Definition at line 47 of file wml_exception.hpp.
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 74 of file wml_exception.cpp.
References VGETTEXT, and WRN_NG.
Referenced by expand_partialresolution(), gui2::gui_definition::gui_definition(), gui2::parse_linked_group_definitions(), gui2::implementation::parse_list_data(), gui2::builder_window::read(), gui2::horizontal_scrollbar_definition::resolution::resolution(), gui2::slider_definition::resolution::resolution(), gui2::vertical_scrollbar_definition::resolution::resolution(), gui2::styled_widget_definition::styled_widget_definition(), terrain_type::terrain_type(), gui2::builder_window::window_resolution::tooltip_info::tooltip_info(), gui2::implementation::tree_node::tree_node(), and gui2::builder_window::window_resolution::window_resolution().
void throw_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. |
dev_message | Any additional information that might be useful to a developer. |
Definition at line 36 of file wml_exception.cpp.
References draw::line().