Stores information about tag. More...
#include <tag.hpp>

Public Types | |
| typedef std::map< std::string, class_tag > | tag_map |
| typedef std::pair< std::string, class_tag > | tag_map_value |
| typedef std::map< std::string, class_key > | key_map |
| typedef std::pair< std::string, class_key > | key_map_value |
| typedef std::map< std::string, std::string > | link_map |
| typedef std::pair< std::string, std::string > | link_map_value |
| typedef key_map::iterator | key_iterator |
| typedef std::pair < key_iterator, key_iterator > | all_key_iterators |
| typedef key_map::const_iterator | const_key_iterator |
| typedef std::pair < const_key_iterator, const_key_iterator > | all_const_key_iterators |
| typedef tag_map::iterator | tag_iterator |
| typedef std::pair < tag_iterator, tag_iterator > | all_tag_iterators |
| typedef tag_map::const_iterator | const_tag_iterator |
| typedef std::pair < const_tag_iterator, const_tag_iterator > | all_const_tag_iterators |
| typedef link_map::iterator | link_iterator |
| typedef std::pair < link_iterator, link_iterator > | all_link_iterators |
| typedef link_map::const_iterator | const_link_iterator |
| typedef std::pair < const_link_iterator, const_link_iterator > | all_const_link_iterators |
Public Member Functions | |
| class_tag () | |
| class_tag (const std::string &name, int min, int max, const std::string &super="") | |
| class_tag (const config &) | |
| ~class_tag () | |
| void | print (std::ostream &os) |
| Prints information about tag to outputstream, recursively is used to print tag info the format is next [tag] subtags keys name="name" min="min" max="max" [/tag]. | |
| const std::string & | get_name () const |
| int | get_min () const |
| int | get_max () const |
| const std::string & | get_super () const |
| bool | is_extension () const |
| void | set_name (const std::string &name) |
| void | set_min (int o) |
| void | set_max (int o) |
| void | set_min (std::string const &s) |
| void | set_max (std::string const &s) |
| void | set_super (std::string const &s) |
| void | add_key (const class_key &new_key) |
| void | add_tag (const class_tag &new_tag) |
| void | add_link (const std::string &link) |
| void | add_tag (const std::string &path, const class_tag &tag, class_tag &root) |
| Tags are usually organized in tree. | |
| bool | operator< (const class_tag &t) const |
| bool | operator== (const class_tag &other) const |
| const class_key * | find_key (const std::string &name) const |
| Returns pointer to child key. | |
| const std::string * | find_link (const std::string &name) const |
| Returns pointer to child link. | |
| const class_tag * | find_tag (const std::string &fullpath, const class_tag &root) const |
| Returns pointer to tag using full path to it. | |
| void | expand_all (class_tag &root) |
| Calls the expansion on each child. | |
| all_const_tag_iterators | tags () const |
| all_const_key_iterators | keys () const |
| all_const_link_iterators | links () const |
| void | remove_key_by_name (const std::string &name) |
| void | remove_keys_by_type (const std::string &type) |
| Removes all keys with this type. | |
Private Member Functions | |
| void | printl (std::ostream &os, int level, int step=4) |
| the same as class_tag::print(std::ostream&) but indents different levels with step space. | |
| class_tag * | find_tag (const std::string &fullpath, class_tag &root) |
| void | add_tags (const tag_map &list) |
| void | add_keys (const key_map &list) |
| void | add_links (const link_map &list) |
| void | append_super (const class_tag &tag, const std::string &super) |
| Copies tags, keys and links of tag to this. | |
| void | expand (class_tag &root) |
| Expands all "super" copying their data to this. | |
Private Attributes | |
| std::string | name_ |
| name of tag | |
| int | min_ |
| number of minimum occasions | |
| int | max_ |
| number of maximum occasions | |
| std::string | super_ |
| name of tag to extend "super-tag" Extension is smth like inheritance and is used in case when you need to use another tag with all his keys, childs, etc. | |
| tag_map | tags_ |
| children tags | |
| key_map | keys_ |
| keys | |
| link_map | links_ |
| links to possible children. | |
Stores information about tag.
Each tags is an element of great tag tree. This tree is close to filesystem: you can use links and special include directory global/ Normally root is not mentioned in path. Each tag has name, minimum and maximum occasions number, and lists of subtags, keys and links.
Definition at line 117 of file tag.hpp.
| typedef std::pair<key_iterator,key_iterator> schema_validation::class_tag::all_key_iterators |
| typedef std::pair<link_iterator,link_iterator> schema_validation::class_tag::all_link_iterators |
| typedef std::pair<tag_iterator,tag_iterator> schema_validation::class_tag::all_tag_iterators |
| typedef key_map::const_iterator schema_validation::class_tag::const_key_iterator |
| typedef link_map::const_iterator schema_validation::class_tag::const_link_iterator |
| typedef tag_map::const_iterator schema_validation::class_tag::const_tag_iterator |
| typedef key_map::iterator schema_validation::class_tag::key_iterator |
| typedef std::map<std::string,class_key> schema_validation::class_tag::key_map |
| typedef std::pair<std::string,class_key> schema_validation::class_tag::key_map_value |
| typedef link_map::iterator schema_validation::class_tag::link_iterator |
| typedef std::map<std::string,std::string> schema_validation::class_tag::link_map |
| typedef std::pair<std::string,std::string> schema_validation::class_tag::link_map_value |
| typedef tag_map::iterator schema_validation::class_tag::tag_iterator |
| typedef std::map<std::string,class_tag> schema_validation::class_tag::tag_map |
| typedef std::pair<std::string,class_tag> schema_validation::class_tag::tag_map_value |
| schema_validation::class_tag::class_tag | ( | const std::string & | name, | |
| int | min, | |||
| int | max, | |||
| const std::string & | super = "" | |||
| ) | [inline] |
| schema_validation::class_tag::class_tag | ( | const config & | cfg | ) |
Definition at line 69 of file tag.cpp.
References add_key(), add_link(), add_tag(), config::child_range(), config::has_attribute(), max_, and super_.

| void schema_validation::class_tag::add_key | ( | const class_key & | new_key | ) | [inline] |
Definition at line 230 of file tag.hpp.
References schema_validation::class_key::get_name(), and keys_.
Referenced by class_tag().


| void schema_validation::class_tag::add_keys | ( | const key_map & | list | ) | [inline, private] |
Definition at line 343 of file tag.hpp.
References keys_.
Referenced by append_super().

| void schema_validation::class_tag::add_link | ( | const std::string & | link | ) |
Definition at line 102 of file tag.cpp.
References links_.
Referenced by append_super(), and class_tag().

| void schema_validation::class_tag::add_links | ( | const link_map & | list | ) | [inline, private] |
Definition at line 346 of file tag.hpp.
References links_.
Referenced by append_super().

| void schema_validation::class_tag::add_tag | ( | const std::string & | path, | |
| const class_tag & | tag, | |||
| class_tag & | root | |||
| ) |
Tags are usually organized in tree.
This fuction helps to add tag to his exact place in tree
| path | - path in subtree to exact place of tag | |
| tag | - tag to add | |
| root | - root of schema tree - use to support of adding to link. Path is getting shotter and shoter with each call. Path schould look like tag1/tag2/parent/ Slash at end is mandatory. |
Definition at line 269 of file tag.cpp.
References add_tag(), get_name(), keys_, links_, max_, min_, name_, pos, set_name(), and tags_.

| void schema_validation::class_tag::add_tag | ( | const class_tag & | new_tag | ) | [inline] |
Definition at line 233 of file tag.hpp.
Referenced by add_tag(), class_tag(), and schema_validation::class_source_parser::close_opened_tags().

| void schema_validation::class_tag::add_tags | ( | const tag_map & | list | ) | [inline, private] |
| void schema_validation::class_tag::append_super | ( | const class_tag & | tag, | |
| const std::string & | super | |||
| ) | [private] |
Copies tags, keys and links of tag to this.
Definition at line 304 of file tag.cpp.
References add_keys(), add_link(), add_links(), keys_, links_, and tags_.
Referenced by expand().


| void schema_validation::class_tag::expand | ( | class_tag & | root | ) | [private] |
Expands all "super" copying their data to this.
Definition at line 314 of file tag.cpp.
References append_super(), expand(), find_tag(), name_, and super_.
Referenced by expand().


| void schema_validation::class_tag::expand_all | ( | class_tag & | root | ) |
Calls the expansion on each child.
Definition at line 153 of file tag.cpp.
References tags_.
Referenced by schema_validation::class_source_parser::expand(), and schema_validation::schema_validator::schema_validator().

| const class_key * schema_validation::class_tag::find_key | ( | const std::string & | name | ) | const |
| const std::string * schema_validation::class_tag::find_link | ( | const std::string & | name | ) | const |
| const class_tag * schema_validation::class_tag::find_tag | ( | const std::string & | fullpath, | |
| const class_tag & | root | |||
| ) | const |
Returns pointer to tag using full path to it.
Also work with links
Definition at line 125 of file tag.cpp.
References find_tag(), links_, pos, and tags_.
Referenced by expand(), and find_tag().


| int schema_validation::class_tag::get_max | ( | ) | const [inline] |
| int schema_validation::class_tag::get_min | ( | ) | const [inline] |
| const std::string& schema_validation::class_tag::get_name | ( | ) | const [inline] |
| const std::string& schema_validation::class_tag::get_super | ( | ) | const [inline] |
| bool schema_validation::class_tag::is_extension | ( | ) | const [inline] |
| all_const_key_iterators schema_validation::class_tag::keys | ( | ) | const [inline] |
| all_const_link_iterators schema_validation::class_tag::links | ( | ) | const [inline] |
| bool schema_validation::class_tag::operator< | ( | const class_tag & | t | ) | const [inline] |
| bool schema_validation::class_tag::operator== | ( | const class_tag & | other | ) | const [inline] |
| void schema_validation::class_tag::print | ( | std::ostream & | os | ) |
Prints information about tag to outputstream, recursively is used to print tag info the format is next [tag] subtags keys name="name" min="min" max="max" [/tag].
Definition at line 98 of file tag.cpp.
References printl().
Referenced by schema_validation::class_source_parser::save_schema().


| void schema_validation::class_tag::printl | ( | std::ostream & | os, | |
| int | level, | |||
| int | step = 4 | |||
| ) | [private] |
the same as class_tag::print(std::ostream&) but indents different levels with step space.
| os | stream to print | |
| level | current level of indentation | |
| step | step to next indent |
Definition at line 198 of file tag.cpp.
References keys_, links_, max_, min_, name_, super_, and tags_.
Referenced by print().

| void schema_validation::class_tag::remove_key_by_name | ( | const std::string & | name | ) | [inline] |
| void schema_validation::class_tag::remove_keys_by_type | ( | const std::string & | type | ) |
Removes all keys with this type.
Works recursively
Definition at line 159 of file tag.cpp.
Referenced by schema_validation::class_source_parser::save_schema().

| void schema_validation::class_tag::set_max | ( | int | o | ) | [inline] |
Definition at line 212 of file tag.hpp.
References max_.
Referenced by schema_validation::class_source_parser::check_tag_begin().

| void schema_validation::class_tag::set_max | ( | std::string const & | s | ) | [inline] |
| void schema_validation::class_tag::set_min | ( | std::string const & | s | ) | [inline] |
| void schema_validation::class_tag::set_min | ( | int | o | ) | [inline] |
Definition at line 209 of file tag.hpp.
References min_.
Referenced by schema_validation::class_source_parser::check_tag_begin().

| void schema_validation::class_tag::set_name | ( | const std::string & | name | ) | [inline] |
Definition at line 206 of file tag.hpp.
References name_.
Referenced by add_tag(), and schema_validation::class_source_parser::check_tag_begin().

| void schema_validation::class_tag::set_super | ( | std::string const & | s | ) | [inline] |
Definition at line 227 of file tag.hpp.
References super_.
Referenced by schema_validation::class_source_parser::check_tag_begin().

| all_const_tag_iterators schema_validation::class_tag::tags | ( | ) | const [inline] |
key_map schema_validation::class_tag::keys_ [private] |
keys
Definition at line 322 of file tag.hpp.
Referenced by add_key(), add_keys(), add_tag(), append_super(), find_key(), keys(), printl(), remove_key_by_name(), and remove_keys_by_type().
link_map schema_validation::class_tag::links_ [private] |
links to possible children.
Definition at line 324 of file tag.hpp.
Referenced by add_link(), add_links(), add_tag(), append_super(), find_link(), find_tag(), links(), and printl().
int schema_validation::class_tag::max_ [private] |
int schema_validation::class_tag::min_ [private] |
std::string schema_validation::class_tag::name_ [private] |
name of tag
Definition at line 306 of file tag.hpp.
Referenced by add_tag(), expand(), get_name(), operator<(), operator==(), printl(), and set_name().
std::string schema_validation::class_tag::super_ [private] |
name of tag to extend "super-tag" Extension is smth like inheritance and is used in case when you need to use another tag with all his keys, childs, etc.
But you also want to allow extra subtags of that tags, so just linking that tag wouldn't help at all.
Definition at line 318 of file tag.hpp.
Referenced by class_tag(), expand(), get_super(), is_extension(), printl(), and set_super().
tag_map schema_validation::class_tag::tags_ [private] |
children tags
Definition at line 320 of file tag.hpp.
Referenced by add_tag(), add_tags(), append_super(), expand_all(), find_tag(), printl(), remove_keys_by_type(), and tags().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:25:52 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |