29 #include <boost/iterator/iterator_facade.hpp> 30 #include <boost/range/iterator.hpp> 50 using tag_map = std::map<std::string, wml_tag>;
51 using key_map = std::map<std::string, wml_key>;
52 using link_map = std::map<std::string, std::string>;
57 template<
typename T,
typename Map = std::map<std::
string, T>>
58 class iterator :
public boost::iterator_facade<iterator<T>, const typename Map::value_type, std::forward_iterator_tag>
108 template<
typename T,
typename Map>
friend class iterator;
128 wml_tag(
const std::string& name,
int min,
int max,
const std::string& super =
"",
bool any =
false)
138 ,
fuzzy_(name.find_first_of(
"*?") !=
std::string::npos)
160 void print(std::ostream& os);
231 void set_max(
const std::string& s);
259 void add_link(
const std::string& link);
290 const std::string*
find_link(
const std::string& name)
const;
301 boost::iterator_range<tag_iterator>
tags(
const config& cfg_match)
const 306 boost::iterator_range<key_iterator>
keys(
const config& cfg_match)
const 382 void printl(std::ostream& os,
int level,
int step = 4);
391 tags_.insert(list.begin(), list.end());
396 keys_.insert(list.begin(), list.end());
401 links_.insert(list.begin(), list.end());
418 bool matches(
const config& cfg)
const;
int min_children_
minimum number of children.
const std::string & get_super() const
int max_children_
maximum number of children.
void ensure_valid_or_end()
int get_min_children() const
friend class boost::iterator_core_access
std::map< std::string, wml_key > key_map
void push_new_tag_conditions(const wml_tag &tag)
void add_switch(const config &switch_cfg)
wml_condition(const config &info, const config &filter)
int get_max_children() const
Stores information about tag.
void add_filter(const config &cond_cfg)
bool operator<(const wml_tag &t) const
void remove_keys_by_type(const std::string &type)
Removes all keys with this type.
Definitions for the interface to Wesnoth Markup Language (WML).
const wml_key * find_key(const std::string &name, const config &match, bool ignore_super=false) const
Returns pointer to child key.
wml_tag(const std::string &name, int min, int max, const std::string &super="", bool any=false)
iterator(const wml_tag &base_tag, const config &match)
boost::iterator_range< key_iterator > keys(const config &cfg_match) const
bool equal(const iterator< T, Map > &other) const
const std::string & get_name() const
void set_min_children(int o)
Map::const_iterator current
void set_max_children(int o)
bool accepts_any_tag() const
void add_keys(const key_map &list)
void add_link(const std::string &link)
const wml_tag * find_tag(const std::string &fullpath, const wml_tag &root, const config &match, bool ignore_super=false) const
Returns pointer to tag using full path to it.
super_list super_refs_
super-tag references
void set_super(const std::string &s)
void add_key(const wml_key &new_key)
std::queue< const wml_tag * > condition_queue
tag_map tags_
children tags
iterator< wml_key > key_iterator
std::vector< wml_condition > condition_list
Stores information about a conditional portion of a tag.
void add_links(const link_map &list)
std::string name_
name of tag.
std::map< std::string, std::string > link_map
static void push_new_tag_conditions(std::queue< const wml_tag *> &q, const config &match, const wml_tag &tag)
void add_tag(const wml_tag &new_tag)
boost::iterator_range< tag_iterator > tags(const config &cfg_match) const
std::map< std::string, wml_tag > tag_map
condition_list conditions_
conditional partial matches
void init(const wml_tag &base_tag)
void printl(std::ostream &os, int level, int step=4)
the same as wml_tag::print(std::ostream&) but indents different levels with step space.
int min_
minimum number of occurrences.
void print(std::ostream &os)
Prints information about tag to outputstream, recursively is used to print tag info the format is nex...
wml_key is used to save the information about one key.
link_map links_
links to possible children.
static map_location::DIRECTION s
int max_
maximum number of occurrences.
bool any_tag_
whether this tag allows arbitrary subtags.
void set_any_tag(bool any)
void set_name(const std::string &name)
void expand(wml_tag &root)
Expands all "super", storing direct references for easier access.
void add_tags(const tag_map &list)
wml_tag * find_tag(const std::string &fullpath, wml_tag &root, const config &match)
void expand_all(wml_tag &root)
Calls the expansion on each child.
This file contains object "key", which is used to store information about keys while annotation parsi...
iterator< T, Map >::reference dereference() const
const std::string & get_name() const
void add_conditions(const condition_list &list)
iterator< wml_tag > tag_iterator
void remove_key_by_name(const std::string &name)
std::string super_
name of tag to extend "super-tag" Extension is smth like inheritance and is used in case when you nee...
bool fuzzy_
whether this is a "fuzzy" tag.
const condition_list & conditions() const
const link_map & links() const
A config object defines a single node in a WML file, with access to child nodes.
std::vector< wml_tag * > super_list
const std::string * find_link(const std::string &name) const
Returns pointer to child link.
bool operator==(const wml_tag &other) const
bool is_extension() const