Exemple #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);
		}
}
Exemple #2
0
	template<> void EntityArray::construct(shared_ptr<XML> xml)
	{
		clear();
		if (xml->has(child_tag()) == false)
			return;

		shared_ptr<XMLList> xmlList = xml->get(child_tag());
		this->reserve(xmlList->size());

		for (size_t i = 0; i < xmlList->size(); i++)
		{
			shared_ptr<XML> xmlElement = xmlList->at(i);
			if (isEmpty(xmlElement) == true)
				continue;

			Entity *entity = createChild();
			entity->construct(xmlList->at(i));

			push_back(entity);
		}
	}