Defines | Functions | Variables

wml_exception.cpp File Reference

Implementation for wml_exception.hpp. More...

#include "global.hpp"
#include "wml_exception.hpp"
#include "display.hpp"
#include "gettext.hpp"
#include "gui/dialogs/message.hpp"
#include "formula_string_utils.hpp"
#include "log.hpp"
Include dependency graph for wml_exception.cpp:

Go to the source code of this file.

Defines

#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.
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.
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.
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 config::attribute_valueget_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.

Variables

static lg::log_domain log_engine ("engine")

Detailed Description

Implementation for wml_exception.hpp.

Definition in file wml_exception.cpp.


Define Documentation

#define GETTEXT_DOMAIN   "wesnoth-lib"

Definition at line 21 of file wml_exception.cpp.

#define WRN_NG   LOG_STREAM(warn, log_engine)

Definition at line 33 of file wml_exception.cpp.

Referenced by missing_mandatory_wml_key().


Function Documentation

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.

Parameters:
key The deprecated key.
removal_version The version in which the key will be removed key.
Returns:
The warning message.

Definition at line 105 of file wml_exception.cpp.

References vgettext().

Here is the call graph for this function:

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.

Parameters:
deprecated_key The deprecated key.
key The new key to be used.
removal_version The version in which the key will be removed key.
Returns:
The warning message.

Definition at line 120 of file wml_exception.cpp.

References vgettext().

Referenced by get_renamed_config_attribute().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Note:
This function is not a member of config, since that would add additional dependencies to the core library.
Parameters:
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.
Returns:
The attribute found as described above.

Definition at line 141 of file wml_exception.cpp.

References deprecated_renamed_wml_key_warning(), config::get(), and lg::wml_error.

Here is the call graph for this function:

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.

Parameters:
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 ommitted key.
primary_key The primary key of the section.
primary_value The value of the primary key (mandatory if primary key isn't empty).
Returns:
The error message.

Definition at line 73 of file wml_exception.cpp.

References vgettext(), and WRN_NG.

Referenced by gui2::twindow_builder::read(), gui2::tcontrol_definition::tcontrol_definition(), terrain_type::terrain_type(), tportrait::tportrait(), gui2::twindow_builder::tresolution::tresolution(), and gui2::twindow_builder::tresolution::ttip::ttip().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
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 35 of file wml_exception.cpp.


Variable Documentation

lg::log_domain log_engine("engine") [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:11:15 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs