23 #include <type_traits>
49 static const config empty_const_cfg;
50 return empty_const_cfg;
55 return "Cannot resolve variable '" + name +
"' for reading.";
76 return "Cannot resolve variable '" + name +
"' for writing.";
99 return "Cannot resolve variable '" + name +
"' for writing without creating new children.";
107 template<
typename T,
typename V>
156 template<
typename T,
typename V>
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
config & mandatory_child(config_key_type key, int n=0)
Returns the nth child with the given key, or throws an error if there is none.
std::size_t child_count(config_key_type key) const
boost::iterator_range< const_child_iterator > const_child_itors
optional_config_impl< config > optional_child(config_key_type key, int n=0)
Equivalent to mandatory_child, but returns an empty optional if the nth child was not found.
config & add_child(config_key_type key)
The variable_info policy classes.
static const config & get_child_at(const config &cfg, const std::string &key, int index)
static std::string error_message(const std::string &name)
Creates a child table when resolving name if it doesn't exist yet.
static std::string error_message(const std::string &name)
static config & get_child_at(config &cfg, const std::string &key, int index)
Will throw an exception when trying to access a nonexistent table.
static config & get_child_at(config &cfg, const std::string &key, int index)
static std::string error_message(const std::string &name)
Definitions for the interface to Wesnoth Markup Language (WML).
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
@ state_named
The result of .someval.
@ state_start
Represents the initial variable state before processing.
@ state_indexed
The result of .someval[index].
@ state_temporary
The result of .length.
Helper struct to clone the constness of one type to another.
std::conditional_t< is_source_const, const T, T > type
The destination type, possibly const qualified.
config::const_child_itors type
config::attribute_value temp_val_
typename maybe_const< config, V >::type child_t
variable_info_state_type type_
variable_info_state(child_t &vars)
typename variable_info_implementation::maybe_const< T, V >::type maybe_const_t
Helper template alias for maybe_const, defined at global scope for convenience.