MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getXMLHeader

Method getXMLHeader

lib/errorlogger.cpp:438–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438std::string ErrorMessage::getXMLHeader(std::string productName, int xmlVersion)
439{
440 const auto nameAndVersion = Settings::getNameAndVersion(productName);
441 productName = nameAndVersion.first;
442 // TODO: lacks extra version
443 const std::string version = nameAndVersion.first.empty() ? CppCheck::version() : nameAndVersion.second;
444
445 tinyxml2::XMLPrinter printer;
446
447 // standard xml header
448 printer.PushDeclaration("xml version=\"1.0\" encoding=\"UTF-8\"");
449
450 // header
451 printer.OpenElement("results", false);
452
453 printer.PushAttribute("version", xmlVersion);
454 printer.OpenElement("cppcheck", false);
455 if (!productName.empty())
456 printer.PushAttribute("product-name", productName.c_str());
457 printer.PushAttribute("version", version.c_str());
458 printer.CloseElement(false);
459 printer.OpenElement("errors", false);
460
461 return std::string(printer.CStr()) + '>';
462}
463
464std::string ErrorMessage::getXMLFooter(int xmlVersion)
465{

Callers

nothing calls this directly

Calls 5

PushDeclarationMethod · 0.80
OpenElementMethod · 0.80
PushAttributeMethod · 0.80
CloseElementMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected