示例#1
0
文件: f8precomp.cpp 项目: mattyv/fix8
//-----------------------------------------------------------------------------------------
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 dump_components(const Components& components, ostream& outf)
{
	if (components.empty())
		return;

	int depth(1);

	outf << string(depth * 2, ' ') << "<components>" << endl;

	for (Components::const_iterator citr(components.begin()); citr != components.end(); ++citr)
	{
		outf << string((depth + 1) * 2, ' ') << "<component name=\"";
		outf << citr->first << "\" id=\"" << (1 + distance(components.begin(), citr)) << "\"/>" << endl;
	}

	outf << string(depth * 2, ' ') << "</components>" << endl;
}
示例#3
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);
	}
}