xml2: Added cppcheck-version

This commit is contained in:
Daniel Marjamäki 2010-12-22 10:29:23 +01:00
parent f392dbef95
commit 3a612d7cd8
2 changed files with 16 additions and 7 deletions

View File

@ -18,6 +18,7 @@
#include "errorlogger.h"
#include "path.h"
#include "cppcheck.h"
#include <sstream>
#include <vector>
@ -129,14 +130,22 @@ bool ErrorLogger::ErrorMessage::deserialize(const std::string &data)
return true;
}
std::string ErrorLogger::ErrorMessage::getXMLHeader(int version)
std::string ErrorLogger::ErrorMessage::getXMLHeader(int xml_version)
{
std::ostringstream strver;
if (version > 1)
strver << " version=\"" << version << "\"";
std::ostringstream ostr;
ostr << "<?xml version=\"1.0\"?>\n";
return "<?xml version=\"1.0\"?>\n"
"<results" + strver.str() + ">";
if (xml_version <= 1)
{
ostr << "<results>";
}
else
{
ostr << "<results version=\"" << xml_version << "\">\n";
ostr << " <cppcheck-version>" << CppCheck::version() << "</cppcheck-version>";
}
return ostr.str();
}
std::string ErrorLogger::ErrorMessage::getXMLFooter()

View File

@ -132,7 +132,7 @@ public:
*/
std::string toXML(bool verbose, int ver) const;
static std::string getXMLHeader(int ver);
static std::string getXMLHeader(int xml_version);
static std::string getXMLFooter();
/**