Пример #1
0
Файл: svg.cpp Проект: ogdf/ogdf
void createDocument(GraphAttributes attr, pugi::xml_document &doc, GraphIO::SVGSettings *settings = nullptr, bool reassignPositions = true) {
	std::ostringstream write;

	if(reassignPositions) {
		int i = 0;
		for(node v : attr.constGraph().nodes) {
			attr.x(v) = attr.y(v) = i++ * 100;
			attr.width(v) = attr.height(v) = 10;
		}
	}

	if(settings == nullptr) {
		GraphIO::drawSVG(attr, write);
	} else {
		GraphIO::drawSVG(attr, write, *settings);
	}

	pugi::xml_parse_result result =  doc.load_string(write.str().c_str());
	AssertThat((bool) result, IsTrue());
}
Пример #2
0
void SrcmlUtil::String2XML(const std::string &code, pugi::xml_document& doc) {
  std::string cmd = "src2srcml -lC";
  std::string xml = ThreadUtil::Exec(cmd.c_str(), code.c_str(), NULL);
  doc.load_string(xml.c_str(), pugi::parse_default | pugi::parse_ws_pcdata);
}
Пример #3
0
void SrcmlUtil::File2XML(const std::string &filename, pugi::xml_document& doc) {
  std::string cmd;
  cmd = "src2srcml " + filename;
  std::string xml = ThreadUtil::Exec(cmd.c_str(), NULL);
  doc.load_string(xml.c_str(), pugi::parse_default | pugi::parse_ws_pcdata);
}