21 #ifndef AI_COMPOSITE_PROPERTY_HANDLER_HPP_INCLUDED
22 #define AI_COMPOSITE_PROPERTY_HANDLER_HPP_INCLUDED
105 if (!cfg[
"id"].empty()) {
107 with_same_id.
id = cfg[
"id"].str();
120 if (child.
id ==
"*") {
136 std::vector<component*> children;
138 children.push_back(&*
v);
157 for (t_ptr
b : values ) {
164 std::function<void(t_ptr_vector&, const config&)>
factory_;
187 if (child.
id ==
"default_facet") {
196 if (child.
id ==
"default_facet") {
232 typename aspect_map::const_iterator
a =
aspects_.find(child.
id);
245 cfg[
"name"] =
"composite_aspect";
247 cfg[
"id"] = child.
id;
260 if (child.
id ==
"*") {
262 for (
typename aspect_map::value_type
a :
aspects_) {
263 b |=
a.second->delete_all_facets();
273 std::vector<component*> children;
274 for (
typename aspect_map::value_type
a :
aspects_) {
275 children.push_back(&*
a.second);
284 std::function<void(aspect_map&, const config&, std::string)>
factory_;
294 property_handlers.insert(std::make_pair(property,handler_ptr));
301 property_handlers.insert(std::make_pair(property,handler_ptr));
308 property_handlers.insert(std::make_pair(property,handler_ptr));
facets_property_handler(const std::string &property, t_ptr_vector &values, t_ptr &def, std::function< void(t_ptr_vector &, const config &)> &construction_factory)
const std::string property_
vector_property_handler< T >::t_ptr_vector t_ptr_vector
std::vector< component * > handle_get_children()
boost::shared_ptr< event_handler > handler_ptr
Shared pointer to handler objects.
vector_property_handler(const std::string &property, t_ptr_vector &values, std::function< void(t_ptr_vector &, const config &)> &construction_factory)
bool handle_add(const path_element &, const config &)
bool handle_add(const path_element &child, const config &cfg)
static void register_vector_property(std::map< std::string, property_handler_ptr > &property_handlers, const std::string &property, std::vector< boost::shared_ptr< X > > &values, std::function< void(std::vector< boost::shared_ptr< X > > &, const config &)> construction_factory)
void call_factory(t_ptr_vector &vec, const config &cfg)
Definitions for the interface to Wesnoth Markup Language (WML).
std::vector< component * > handle_get_children()
GLboolean GLenum GLenum GLvoid * values
bool handle_delete(const path_element &child)
bool handle_delete(const path_element &child)
GLdouble GLdouble GLdouble b
A small explanation about what's going on here: Each action has access to two game_info objects First...
vector_property_handler< T >::t_ptr t_ptr
static void register_aspect_property(std::map< std::string, property_handler_ptr > &property_handlers, const std::string &property, std::map< std::string, boost::shared_ptr< X > > &aspects, std::function< void(std::map< std::string, boost::shared_ptr< X > > &, const config &, std::string)> construction_factory)
component * handle_get(const path_element &child)
bool operator()(const T &t)
static void register_facets_property(std::map< std::string, property_handler_ptr > &property_handlers, const std::string &property, std::vector< boost::shared_ptr< X > > &values, boost::shared_ptr< X > &def, std::function< void(std::vector< boost::shared_ptr< X > > &, const config &)> construction_factory)
std::vector< component * > handle_get_children()
virtual ~base_property_handler()
path_element_matches(const path_element &element)
A component of the AI framework.
GLboolean GLboolean GLboolean GLboolean a
boost::shared_ptr< T > t_ptr
std::map< std::string, t_ptr > aspect_map
bool handle_change(const path_element &child, config cfg)
virtual bool handle_change(const path_element &child, config cfg)=0
const std::string & property_
virtual component * handle_get(const path_element &child)=0
virtual bool handle_delete(const path_element &child)=0
virtual ~path_element_matches()
bool do_add(int pos, const config &cfg)
component * handle_get(const path_element &child)
bool has_attribute(const std::string &key) const
boost::shared_ptr< T > t_ptr
std::vector< boost::shared_ptr< T > > t_ptr_vector
bool handle_change(const path_element &child, config cfg)
component * handle_get(const path_element &child)
std::function< void(aspect_map &, const config &, std::string)> factory_
virtual bool handle_add(const path_element &child, const config &cfg)=0
boost::shared_ptr< base_property_handler > property_handler_ptr
std::function< void(t_ptr_vector &, const config &)> factory_
A config object defines a single node in a WML file, with access to child nodes.
bool handle_change(const path_element &child, config cfg)
virtual std::vector< component * > handle_get_children()=0
GLsizei const GLcharARB ** string
aspect_property_handler(const std::string &property, aspect_map &aspects, std::function< void(aspect_map &, const config &, std::string)> &construction_factory)