76 typedef std::shared_ptr<T>
ptr;
104 if (!cfg[
"id"].empty()) {
106 with_same_id.
id = cfg[
"id"].str();
119 if (child.
id ==
"*") {
134 std::vector<component*> children;
136 children.push_back(&*v);
155 for (
ptr b : values ) {
183 if (child.
id ==
"default_facet") {
192 if (child.
id ==
"default_facet") {
215 typedef std::shared_ptr<T>
ptr;
225 typename aspect_map::const_iterator a =
aspects_.find(child.
id);
238 cfg[
"name"] =
"composite_aspect";
240 cfg[
"id"] = child.
id;
253 if (child.
id ==
"*") {
255 for (
typename aspect_map::value_type a :
aspects_) {
256 b |= a.second->delete_all_facets();
265 std::vector<component*> children;
266 for (
typename aspect_map::value_type a :
aspects_) {
267 children.push_back(&*a.second);
282 std::vector<std::shared_ptr<X>>& values, std::function<
void(std::vector<std::shared_ptr<X>>&,
const config&)> construction_factory)
284 property_handlers.emplace(property,
290 std::vector<std::shared_ptr<X>>& values, std::shared_ptr<X>& def, std::function<
void(std::vector<std::shared_ptr<X>>&,
const config&)> construction_factory)
292 property_handlers.emplace(property,
298 std::map<std::string, std::shared_ptr<X>>& aspects, std::function<
void(std::map<std::string, std::shared_ptr<X>>&,
const config&, std::string)> construction_factory)
300 property_handlers.emplace(property,
aspect_property_handler(const std::string &property, aspect_map &aspects, std::function< void(aspect_map &, const config &, std::string)> &construction_factory)
bool handle_add(const path_element &, const config &)
const std::string & property_
std::function< void(aspect_map &, const config &, std::string)> factory_
std::map< std::string, ptr > aspect_map
component * handle_get(const path_element &child)
bool handle_change(const path_element &child, config cfg)
bool handle_delete(const path_element &child)
std::vector< component * > handle_get_children()
virtual bool handle_delete(const path_element &child)=0
virtual bool handle_add(const path_element &child, const config &cfg)=0
virtual std::vector< component * > handle_get_children()=0
virtual bool handle_change(const path_element &child, config cfg)=0
virtual component * handle_get(const path_element &child)=0
virtual ~base_property_handler()
facets_property_handler(const std::string &property, ptr_vector &values, ptr &def, std::function< void(ptr_vector &, const config &)> &construction_factory)
std::vector< component * > handle_get_children()
component * handle_get(const path_element &child)
vector_property_handler< T >::ptr ptr
bool handle_change(const path_element &child, config cfg)
vector_property_handler< T >::ptr_vector ptr_vector
bool operator()(const T &t)
virtual ~path_element_matches()
path_element_matches(const path_element &element)
void call_factory(ptr_vector &vec, const config &cfg)
vector_property_handler(const std::string &property, ptr_vector &values, std::function< void(ptr_vector &, const config &)> &construction_factory)
std::function< void(ptr_vector &, const config &)> factory_
const std::string property_
bool handle_add(const path_element &child, const config &cfg)
bool do_add(int pos, const config &cfg)
std::vector< component * > handle_get_children()
std::vector< std::shared_ptr< T > > ptr_vector
bool handle_change(const path_element &child, config cfg)
bool handle_delete(const path_element &child)
component * handle_get(const path_element &child)
A config object defines a single node in a WML file, with access to child nodes.
bool has_attribute(config_key_type key) const
A component of the AI framework.
Definitions for the interface to Wesnoth Markup Language (WML).
A small explanation about what's going on here: Each action has access to two game_info objects First...
static void register_aspect_property(property_handler_map &property_handlers, const std::string &property, std::map< std::string, std::shared_ptr< X >> &aspects, std::function< void(std::map< std::string, std::shared_ptr< X >> &, const config &, std::string)> construction_factory)
std::shared_ptr< base_property_handler > property_handler_ptr
static void register_facets_property(property_handler_map &property_handlers, const std::string &property, std::vector< std::shared_ptr< X >> &values, std::shared_ptr< X > &def, std::function< void(std::vector< std::shared_ptr< X >> &, const config &)> construction_factory)
std::map< std::string, property_handler_ptr > property_handler_map
static void register_vector_property(property_handler_map &property_handlers, const std::string &property, std::vector< std::shared_ptr< X >> &values, std::function< void(std::vector< std::shared_ptr< X >> &, const config &)> construction_factory)
std::string::const_iterator iterator