Public Types | Public Member Functions | Private Member Functions | Private Attributes

schema_validation::class_tag Class Reference

Stores information about tag. More...

#include <tag.hpp>

Collaboration diagram for schema_validation::class_tag:
Collaboration graph
[legend]

List of all members.

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_keyfind_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_tagfind_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_tagfind_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.

Detailed Description

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.


Member Typedef Documentation

Definition at line 133 of file tag.hpp.

Definition at line 147 of file tag.hpp.

Definition at line 140 of file tag.hpp.

Definition at line 129 of file tag.hpp.

Definition at line 143 of file tag.hpp.

Definition at line 136 of file tag.hpp.

typedef key_map::const_iterator schema_validation::class_tag::const_key_iterator

Definition at line 131 of file tag.hpp.

typedef link_map::const_iterator schema_validation::class_tag::const_link_iterator

Definition at line 145 of file tag.hpp.

typedef tag_map::const_iterator schema_validation::class_tag::const_tag_iterator

Definition at line 138 of file tag.hpp.

typedef key_map::iterator schema_validation::class_tag::key_iterator

Definition at line 128 of file tag.hpp.

typedef std::map<std::string,class_key> schema_validation::class_tag::key_map

Definition at line 122 of file tag.hpp.

Definition at line 123 of file tag.hpp.

typedef link_map::iterator schema_validation::class_tag::link_iterator

Definition at line 142 of file tag.hpp.

typedef std::map<std::string,std::string> schema_validation::class_tag::link_map

Definition at line 125 of file tag.hpp.

typedef std::pair<std::string,std::string> schema_validation::class_tag::link_map_value

Definition at line 126 of file tag.hpp.

typedef tag_map::iterator schema_validation::class_tag::tag_iterator

Definition at line 135 of file tag.hpp.

typedef std::map<std::string,class_tag> schema_validation::class_tag::tag_map

Definition at line 119 of file tag.hpp.

Definition at line 120 of file tag.hpp.


Constructor & Destructor Documentation

schema_validation::class_tag::class_tag (  )  [inline]

Definition at line 149 of file tag.hpp.

schema_validation::class_tag::class_tag ( const std::string &  name,
int  min,
int  max,
const std::string &  super = "" 
) [inline]

Definition at line 160 of file tag.hpp.

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_.

Here is the call graph for this function:

schema_validation::class_tag::~class_tag (  )  [inline]

Definition at line 175 of file tag.hpp.


Member Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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

Parameters:
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_.

Here is the call graph for this function:

void schema_validation::class_tag::add_tag ( const class_tag new_tag  )  [inline]

Definition at line 233 of file tag.hpp.

References name_, and tags_.

Referenced by add_tag(), class_tag(), and schema_validation::class_source_parser::close_opened_tags().

Here is the caller graph for this function:

void schema_validation::class_tag::add_tags ( const tag_map list  )  [inline, private]

Definition at line 340 of file tag.hpp.

References tags_.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

const class_key * schema_validation::class_tag::find_key ( const std::string &  name  )  const

Returns pointer to child key.

Definition at line 109 of file tag.cpp.

References keys_.

const std::string * schema_validation::class_tag::find_link ( const std::string &  name  )  const

Returns pointer to child link.

Definition at line 117 of file tag.cpp.

References links_.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

class_tag * schema_validation::class_tag::find_tag ( const std::string &  fullpath,
class_tag root 
) [private]

Definition at line 228 of file tag.cpp.

References find_tag(), links_, pos, and tags_.

Here is the call graph for this function:

int schema_validation::class_tag::get_max (  )  const [inline]

Definition at line 196 of file tag.hpp.

References max_.

int schema_validation::class_tag::get_min (  )  const [inline]

Definition at line 193 of file tag.hpp.

References min_.

const std::string& schema_validation::class_tag::get_name (  )  const [inline]

Definition at line 190 of file tag.hpp.

References name_.

Referenced by add_tag().

Here is the caller graph for this function:

const std::string& schema_validation::class_tag::get_super (  )  const [inline]

Definition at line 199 of file tag.hpp.

References super_.

bool schema_validation::class_tag::is_extension (  )  const [inline]

Definition at line 202 of file tag.hpp.

References super_.

all_const_key_iterators schema_validation::class_tag::keys (  )  const [inline]

Definition at line 279 of file tag.hpp.

References keys_.

all_const_link_iterators schema_validation::class_tag::links (  )  const [inline]

Definition at line 282 of file tag.hpp.

References links_.

bool schema_validation::class_tag::operator< ( const class_tag t  )  const [inline]

Definition at line 250 of file tag.hpp.

References name_.

bool schema_validation::class_tag::operator== ( const class_tag other  )  const [inline]

Definition at line 253 of file tag.hpp.

References name_.

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
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().

Here is the caller graph for this function:

void schema_validation::class_tag::remove_key_by_name ( const std::string &  name  )  [inline]

Definition at line 286 of file tag.hpp.

References keys_.

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.

References keys_, and tags_.

Referenced by schema_validation::class_source_parser::save_schema().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

void schema_validation::class_tag::set_max ( std::string const &  s  )  [inline]

Definition at line 221 of file tag.hpp.

References max_.

void schema_validation::class_tag::set_min ( std::string const &  s  )  [inline]

Definition at line 215 of file tag.hpp.

References min_.

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

all_const_tag_iterators schema_validation::class_tag::tags (  )  const [inline]

Definition at line 276 of file tag.hpp.

References tags_.


Member Data Documentation

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().

number of maximum occasions

Definition at line 310 of file tag.hpp.

Referenced by add_tag(), class_tag(), get_max(), printl(), and set_max().

number of minimum occasions

Definition at line 308 of file tag.hpp.

Referenced by add_tag(), get_min(), printl(), and set_min().

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().

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().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:25:52 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs