20 #include <boost/range/iterator_range.hpp> 23 #define ERR_CONFIG LOG_STREAM(err, log_config) 24 #define WRN_CONFIG LOG_STREAM(warn, log_config) 25 #define LOG_CONFIG LOG_STREAM(info, log_config) 31 if(
cfgs_.size() <= 1 || key !=
"terrain_graphics") {
40 for(
const config& cfg : boost::make_iterator_range(
cfgs_.begin() + 1,
cfgs_.end())) {
59 LOG_CONFIG <<
"gcv : cannot find [" << key <<
"] with " << name <<
"=" << value <<
", count = " << cfgs_.size();
61 return cfg.
child(
"invalid");
67 if(
const auto res = cfg.optional_child(key)) {
72 return cfg.
child(
"invalid");
79 if(
const auto res = cfg.optional_child(key)) {
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...
config & find_child(config_key_type key, const std::string &name, const std::string &value)
Returns the first child of tag key with a name attribute containing value.
config_array_view child_range(config_key_type key) const
child_itors child_range(config_key_type key)
Definitions for the interface to Wesnoth Markup Language (WML).
std::string_view config_key_type
static lg::log_domain log_config("config")
game_config_view merged_children_view(config_key_type key) const
const config & child_or_empty(config_key_type key) const
const config & find_child(config_key_type key, const std::string &name, const std::string &value) const
std::vector< std::reference_wrapper< const config > > config_array_view
Standard logging facilities (interface).
A config object defines a single node in a WML file, with access to child nodes.
const config & child(config_key_type key) const