23 #include <type_traits> 49 static const config empty_const_cfg;
50 return empty_const_cfg;
55 return "Cannot resolve variable '" + name +
"' for reading.";
67 while(static_cast<int>(cfg.
child_count(key)) <= index) {
71 return cfg.
child(key, index);
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>
config & child(config_key_type key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
typename variable_info_implementation::maybe_const< T, V >::type maybe_const_t
Helper template alias for maybe_const, defined at global scope for convenience.
static std::string error_message(const std::string &name)
Variant for storing WML attributes.
static std::string error_message(const std::string &name)
Helper struct to clone the constness of one type to another.
unsigned child_count(config_key_type key) const
variable_info_state(child_t &vars)
typename maybe_const< config, V >::type child_t
Represents the initial variable state before processing.
Creates a child table when resolving name if it doesn't exist yet.
The result of .someval[index].
Definitions for the interface to Wesnoth Markup Language (WML).
static config & get_child_at(config &cfg, const std::string &key, int index)
config::const_child_itors type
variable_info_state_type type_
config::attribute_value temp_val_
Will throw an exception when trying to access a nonexistent table.
boost::iterator_range< const_child_iterator > const_child_itors
std::conditional_t< is_source_const, const T, T > type
The destination type, possibly const qualified.
static config & get_child_at(config &cfg, const std::string &key, int index)
static std::string error_message(const std::string &name)
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.
static const config & get_child_at(const config &cfg, const std::string &key, int index)
config & add_child(config_key_type key)
The variable_info policy classes.
A config object defines a single node in a WML file, with access to child nodes.