Exemplo n.º 1
0
class_tag::class_tag(const config & cfg)
	: name_(cfg["name"].str())
	, min_(cfg["min"].to_int())
	, max_(cfg["max"].to_int())
	, super_("")
	, tags_()
	, keys_()
	, links_()
{
		if (max_ < 0){
			max_ = INT_MAX;
		}
		if (cfg.has_attribute("super")){
			super_ = cfg["super"].str();
		}
		foreach (const config &child, cfg.child_range("tag")) {
			class_tag child_tag (child);
			add_tag(child_tag);
		}
		foreach (const config &child, cfg.child_range("key")) {
			class_key child_key (child);
			add_key(child_key);
		}
		foreach (const config &link, cfg.child_range("link")) {
			std::string link_name = link["name"].str();
			add_link(link_name);
		}
}
Exemplo n.º 2
0
void build_index_map(typename forest_map<T>::type&       map,
                     adobe::bitpath_t                    key,
                     typename adobe::forest<T>::iterator value)
{
#ifndef NDEBUG
    const T& debug_val(*value);
    #pragma unused(debug_val)
#endif

    map[key] = value;

    adobe::bitpath_t child_key(adobe::first_child_of(key));
    adobe::bitpath_t sibling_key(adobe::next_sibling_of(key));

    // add the first child if one exists (the left branch)
    if (adobe::has_children(value))
        build_index_map<T>(map, child_key, ++adobe::leading_of(value));

    // add the next sibling if one exists (the right branch)
    if (has_next_sibling(value))
        build_index_map<T>(map, sibling_key, ++adobe::trailing_of(value));
}