Пример #1
0
//-----------------------------------------------------------------------------------------
void process_component(const XmlElement& xf, const Components& components, const int depth, ostream& outf)
{
	string name;
	xf.GetAttr("name", name);
	Components::const_iterator citr(components.find(name));
	if (citr == components.end())
	{
		cerr << shortName << ':' << recover_line(xf) << ": error: Could not find component " << name << endl;
		++glob_errors;
	}
	else
		for(XmlElement::XmlSet::const_iterator itr(citr->second->begin()); itr != citr->second->end(); ++itr)
			process_elements(itr, components, depth, outf);
}
Пример #2
0
//-----------------------------------------------------------------------------------------
void process_component(const XmlElement& xf, const Components& components, const int depth, ostream& outf, bool required)
{
	string name;
	xf.GetAttr("name", name);
	bool comp_required(xf.FindAttr("required", false));

	Components::const_iterator citr(components.find(name));
	if (citr == components.end())
	{
		cerr << shortName << ':' << recover_line(xf) << ": error: Could not find component '" << name << '\'' << endl;
		++glob_errors;
	}
	else
	{
		for(XmlElement::XmlSet::const_iterator itr(citr->second->begin()); itr != citr->second->end(); ++itr)
			process_elements(itr, components, depth, outf, name,
				depth == 3 ? comp_required : comp_required && required);
	}
}