29 #include <boost/lexical_cast.hpp>
30 #include <boost/regex.hpp>
41 #define DBG_AI_COMPONENT LOG_STREAM(debug, log_ai_component)
42 #define LOG_AI_COMPONENT LOG_STREAM(info, log_ai_component)
43 #define ERR_AI_COMPONENT LOG_STREAM(err, log_ai_component)
76 return i->second->handle_get(child);
86 return i->second->handle_add(child,cfg);
96 return i->second->handle_change(child,cfg);
106 return i->second->handle_delete(child);
116 return i->second->handle_get_children();
119 return std::vector<component*>();
125 std::vector<std::string>
types;
127 types.push_back(ph.first);
145 boost::regex re(
"([^\\.^\\[]+)(\\[(\\d*)\\]|\\[([^\\]]+)\\]|())");
146 int const sub_matches[] = {1,3,4};
147 boost::sregex_token_iterator
i(path.begin(), path.end(), re, sub_matches);
148 boost::sregex_token_iterator j;
152 std::vector< path_element > elements;
159 if (position.empty()) {
164 }
catch (boost::bad_lexical_cast){
169 elements.push_back(pe);
171 if (elements.size()<1) {
232 std::stringstream offset_ss;
282 o <<
"property["<<e.
property<<
"] id["<<e.
id <<
"] position["<<e.
position<<
"]"<<std::endl;
virtual std::string get_id() const =0
virtual bool change_child(const path_element &child, const config &cfg)
property_handler_map property_handlers_
static bool change_component(component *root, const std::string &path, const config &cfg)
virtual std::vector< component * > get_children(const std::string &type)
GLuint GLuint GLsizei GLenum type
property_handler_map & property_handlers()
AI Support engine - creating specific ai components from config.
To lexical_cast(From value)
Lexical cast converts one type to another.
Definitions for the interface to Wesnoth Markup Language (WML).
GLsizei GLenum GLenum * types
virtual bool add_child(const path_element &child, const config &cfg)
static component * find_component(component *root, const std::string &path, path_element &tail)
A small explanation about what's going on here: Each action has access to two game_info objects First...
static component * get_component(component *root, const std::string &path)
GLsizei const char ** path
static void print_component(component *root, const std::string &type, std::stringstream &s, int offset)
virtual std::string get_engine() const =0
A component of the AI framework.
std::ostream & operator<<(std::ostream &o, const ai::path_element &e)
virtual component * get_child(const path_element &child)
virtual std::string get_name() const =0
static bool delete_component(component *root, const std::string &path)
static lg::log_domain log_ai_component("ai/component")
static bool add_component(component *root, const std::string &path, const config &cfg)
virtual bool delete_child(const path_element &child)
static std::string print_component_tree(component *root, const std::string &path)
virtual std::vector< std::string > get_children_types()
config & child(const std::string &key, int n=0)
Returns the nth child with the given key, or a reference to an invalid config if there is none...
std::map< std::string, property_handler_ptr > property_handler_map
Standard logging facilities (interface).
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
std::vector< t_terrain > t_list