Exemplo n.º 1
0
//-----------------------------------------------------------------------------------------
int precompfixt(XmlElement& xft, XmlElement& xf, ostream& outf, bool nounique)
{
	int depth(1);
	XmlElement::XmlSet fldlist;
	xft.find("fix/fields/field", fldlist);
	xf.find("fix/fields/field", fldlist);
	if (!nounique)
		filter_unique(fldlist);

	XmlElement::XmlSet comlist, comlistfixt;
	Components components, componentsfixt;
	xft.find("fix/components/component", comlistfixt);
	xf.find("fix/components/component", comlist);
	load_components(comlistfixt, componentsfixt);
	load_components(comlist, components);

	outf << doctype << endl;
	outf << '<' << xft.GetTag();
	output_attributes(xft, outf);
	outf << '>' << endl;

	const XmlElement *header(xft.find("fix/header"));
	if (header)
		process_messages(*header, componentsfixt, "header", 0, outf);
	const XmlElement *trailer(xft.find("fix/trailer"));
	if (trailer)
		process_messages(*trailer, componentsfixt, "trailer", 0, outf);

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

	XmlElement::XmlSet msglist;
	xft.find("fix/messages/message", msglist);
	for(auto const *pp : msglist)
		process_messages(*pp, componentsfixt, "message", depth, outf);

	msglist.clear();
	xf.find("fix/messages/message", msglist);
	for(auto const *pp : msglist)
		process_messages(*pp, components, "message", depth, outf);
	outf << string(depth * 2, ' ') << "</messages>" << endl;

	process_fields(fldlist, depth, outf);

	dump_components(components, outf);

	outf << "</" << xft.GetTag() << '>' << endl;

	return 0;
}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------------------
int precomp(XmlElement& xf, ostream& outf)
{
	int depth(1);
	XmlElement::XmlSet fldlist;
	xf.find("fix/fields/field", fldlist);

	XmlElement::XmlSet comlist;
	xf.find("fix/components/component", comlist);
	Components components;
	load_components(comlist, components);

	XmlElement::XmlSet msglist;
	xf.find("fix/messages/message", msglist);

	outf << doctype << endl;
	outf << '<' << xf.GetTag();
	output_attributes(xf, outf);
	outf << '>' << endl;

	const XmlElement *header(xf.find("fix/header"));
	if (header)
		process_messages(*header, components, "header", 0, outf);
	const XmlElement *trailer(xf.find("fix/trailer"));
	if (trailer)
		process_messages(*trailer, components, "trailer", 0, outf);

	outf << string(depth * 2, ' ') << "<messages>" << endl;
	for(XmlElement::XmlSet::const_iterator itr(msglist.begin()); itr != msglist.end(); ++itr)
		process_messages(**itr, components, "message", depth, outf);
	outf << string(depth * 2, ' ') << "</messages>" << endl;

	process_fields(fldlist, depth, outf);

	dump_components(components, outf);

	outf << "</" << xf.GetTag() << '>' << endl;

	return 0;
}