Merge branch 'xml2-refactoring'
This commit is contained in:
commit
c116caa7eb
|
@ -69,6 +69,8 @@ HEADERS += mainwindow.h \
|
||||||
report.h \
|
report.h \
|
||||||
txtreport.h \
|
txtreport.h \
|
||||||
xmlreport.h \
|
xmlreport.h \
|
||||||
|
xmlreportv1.h \
|
||||||
|
xmlreportv2.h \
|
||||||
translationhandler.h \
|
translationhandler.h \
|
||||||
csvreport.h \
|
csvreport.h \
|
||||||
logview.h \
|
logview.h \
|
||||||
|
@ -96,6 +98,8 @@ SOURCES += main.cpp \
|
||||||
report.cpp \
|
report.cpp \
|
||||||
txtreport.cpp \
|
txtreport.cpp \
|
||||||
xmlreport.cpp \
|
xmlreport.cpp \
|
||||||
|
xmlreportv1.cpp \
|
||||||
|
xmlreportv2.cpp \
|
||||||
translationhandler.cpp \
|
translationhandler.cpp \
|
||||||
csvreport.cpp \
|
csvreport.cpp \
|
||||||
logview.cpp \
|
logview.cpp \
|
||||||
|
|
|
@ -579,7 +579,7 @@ void MainWindow::ShowAuthors()
|
||||||
void MainWindow::Save()
|
void MainWindow::Save()
|
||||||
{
|
{
|
||||||
QString selectedFilter;
|
QString selectedFilter;
|
||||||
QString filter(tr("XML files (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
|
QString filter(tr("XML files version 2 (*.xml);;XML files version 1 (*.xml);;Text files (*.txt);;CSV files (*.csv)"));
|
||||||
QString selectedFile = QFileDialog::getSaveFileName(this,
|
QString selectedFile = QFileDialog::getSaveFileName(this,
|
||||||
tr("Save the report file"),
|
tr("Save the report file"),
|
||||||
QString(),
|
QString(),
|
||||||
|
@ -589,12 +589,18 @@ void MainWindow::Save()
|
||||||
if (!selectedFile.isEmpty())
|
if (!selectedFile.isEmpty())
|
||||||
{
|
{
|
||||||
Report::Type type = Report::TXT;
|
Report::Type type = Report::TXT;
|
||||||
if (selectedFilter == tr("XML files (*.xml)"))
|
if (selectedFilter == tr("XML files version 1 (*.xml)"))
|
||||||
{
|
{
|
||||||
type = Report::XML;
|
type = Report::XML;
|
||||||
if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
|
if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
|
||||||
selectedFile += ".xml";
|
selectedFile += ".xml";
|
||||||
}
|
}
|
||||||
|
else if (selectedFilter == tr("XML files version 2 (*.xml)"))
|
||||||
|
{
|
||||||
|
type = Report::XMLV2;
|
||||||
|
if (!selectedFile.endsWith(".xml", Qt::CaseInsensitive))
|
||||||
|
selectedFile += ".xml";
|
||||||
|
}
|
||||||
else if (selectedFilter == tr("Text files (*.txt)"))
|
else if (selectedFilter == tr("Text files (*.txt)"))
|
||||||
{
|
{
|
||||||
type = Report::TXT;
|
type = Report::TXT;
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
{
|
{
|
||||||
TXT,
|
TXT,
|
||||||
XML,
|
XML,
|
||||||
|
XMLV2,
|
||||||
CSV,
|
CSV,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "txtreport.h"
|
#include "txtreport.h"
|
||||||
#include "xmlreport.h"
|
#include "xmlreport.h"
|
||||||
|
#include "xmlreportv1.h"
|
||||||
|
#include "xmlreportv2.h"
|
||||||
#include "csvreport.h"
|
#include "csvreport.h"
|
||||||
#include "applicationlist.h"
|
#include "applicationlist.h"
|
||||||
#include "checkstatistics.h"
|
#include "checkstatistics.h"
|
||||||
|
@ -130,7 +132,10 @@ void ResultsView::Save(const QString &filename, Report::Type type)
|
||||||
report = new TxtReport(filename, this);
|
report = new TxtReport(filename, this);
|
||||||
break;
|
break;
|
||||||
case Report::XML:
|
case Report::XML:
|
||||||
report = new XmlReport(filename, this);
|
report = new XmlReportV1(filename, this);
|
||||||
|
break;
|
||||||
|
case Report::XMLV2:
|
||||||
|
report = new XmlReportV2(filename, this);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,8 +244,23 @@ void ResultsView::DisableProgressbar()
|
||||||
|
|
||||||
void ResultsView::ReadErrorsXml(const QString &filename)
|
void ResultsView::ReadErrorsXml(const QString &filename)
|
||||||
{
|
{
|
||||||
XmlReport *report = new XmlReport(filename, this);
|
const int version = XmlReport::determineVersion(filename);
|
||||||
QList<ErrorLine> errors;
|
if (version == 0)
|
||||||
|
{
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText(tr("Failed to read the report."));
|
||||||
|
msgBox.setIcon(QMessageBox::Critical);
|
||||||
|
msgBox.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlReport *report = NULL;
|
||||||
|
if (version == 1)
|
||||||
|
report = new XmlReportV1(filename, this);
|
||||||
|
else if (version == 2)
|
||||||
|
report = new XmlReportV2(filename, this);
|
||||||
|
|
||||||
|
QList<ErrorItem> errors;
|
||||||
if (report)
|
if (report)
|
||||||
{
|
{
|
||||||
if (report->Open())
|
if (report->Open())
|
||||||
|
@ -263,10 +283,9 @@ void ResultsView::ReadErrorsXml(const QString &filename)
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorLine line;
|
ErrorItem item;
|
||||||
foreach(line, errors)
|
foreach(item, errors)
|
||||||
{
|
{
|
||||||
ErrorItem item(line);
|
|
||||||
mUI.mTree->AddErrorItem(item);
|
mUI.mTree->AddErrorItem(item);
|
||||||
}
|
}
|
||||||
mUI.mTree->SetCheckDirectory("");
|
mUI.mTree->SetCheckDirectory("");
|
||||||
|
|
|
@ -18,122 +18,70 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamReader>
|
||||||
#include <QDebug>
|
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "erroritem.h"
|
|
||||||
#include "xmlreport.h"
|
#include "xmlreport.h"
|
||||||
|
|
||||||
static const char ResultElementName[] = "results";
|
static const char ResultElementName[] = "results";
|
||||||
static const char ErrorElementName[] = "error";
|
static const char VersionAttribute[] = "version";
|
||||||
static const char FilenameAttribute[] = "file";
|
|
||||||
static const char LineAttribute[] = "line";
|
|
||||||
static const char IdAttribute[] = "id";
|
|
||||||
static const char SeverityAttribute[] = "severity";
|
|
||||||
static const char MsgAttribute[] = "msg";
|
|
||||||
|
|
||||||
XmlReport::XmlReport(const QString &filename, QObject * parent) :
|
XmlReport::XmlReport(const QString &filename, QObject * parent) :
|
||||||
Report(filename, parent),
|
Report(filename, parent)
|
||||||
mXmlReader(NULL),
|
|
||||||
mXmlWriter(NULL)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlReport::~XmlReport()
|
QString XmlReport::quoteMessage(const QString &message)
|
||||||
{
|
{
|
||||||
delete mXmlReader;
|
QString quotedMessage(message);
|
||||||
delete mXmlWriter;
|
quotedMessage.replace("&", "&");
|
||||||
Close();
|
quotedMessage.replace("\"", """);
|
||||||
|
quotedMessage.replace("'", "'");
|
||||||
|
quotedMessage.replace("<", "<");
|
||||||
|
quotedMessage.replace(">", ">");
|
||||||
|
return quotedMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XmlReport::Create()
|
QString XmlReport::unquoteMessage(const QString &message)
|
||||||
{
|
{
|
||||||
bool success = false;
|
QString quotedMessage(message);
|
||||||
if (Report::Create())
|
quotedMessage.replace("&", "&");
|
||||||
|
quotedMessage.replace(""", "\"");
|
||||||
|
quotedMessage.replace("'", "'");
|
||||||
|
quotedMessage.replace("<", "<");
|
||||||
|
quotedMessage.replace(">", ">");
|
||||||
|
return quotedMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
int XmlReport::determineVersion(const QString &filename)
|
||||||
|
{
|
||||||
|
QFile file;
|
||||||
|
file.setFileName(filename);
|
||||||
|
bool succeed = file.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||||
|
if (!succeed)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
QXmlStreamReader reader(&file);
|
||||||
|
while (!reader.atEnd())
|
||||||
{
|
{
|
||||||
mXmlWriter = new QXmlStreamWriter(Report::GetFile());
|
switch (reader.readNext())
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XmlReport::Open()
|
|
||||||
{
|
|
||||||
bool success = false;
|
|
||||||
if (Report::Open())
|
|
||||||
{
|
|
||||||
mXmlReader = new QXmlStreamReader(Report::GetFile());
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmlReport::WriteHeader()
|
|
||||||
{
|
|
||||||
mXmlWriter->setAutoFormatting(true);
|
|
||||||
mXmlWriter->writeStartDocument();
|
|
||||||
mXmlWriter->writeStartElement(ResultElementName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmlReport::WriteFooter()
|
|
||||||
{
|
|
||||||
mXmlWriter->writeEndElement();
|
|
||||||
mXmlWriter->writeEndDocument();
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmlReport::WriteError(const ErrorItem &error)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
Error example from the core program in xml
|
|
||||||
<error file="gui/test.cpp" line="14" id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"/>
|
|
||||||
The callstack seems to be ignored here as well, instead last item of the stack is used
|
|
||||||
*/
|
|
||||||
|
|
||||||
mXmlWriter->writeStartElement(ErrorElementName);
|
|
||||||
const QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
|
|
||||||
mXmlWriter->writeAttribute(FilenameAttribute, file);
|
|
||||||
const QString line = QString::number(error.lines[error.lines.size() - 1]);
|
|
||||||
mXmlWriter->writeAttribute(LineAttribute, line);
|
|
||||||
mXmlWriter->writeAttribute(IdAttribute, error.id);
|
|
||||||
mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
|
|
||||||
mXmlWriter->writeAttribute(MsgAttribute, error.message);
|
|
||||||
mXmlWriter->writeEndElement();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ErrorLine> XmlReport::Read()
|
|
||||||
{
|
|
||||||
QList<ErrorLine> errors;
|
|
||||||
bool insideResults = false;
|
|
||||||
if (!mXmlReader)
|
|
||||||
{
|
|
||||||
qDebug() << "You must Open() the file before reading it!";
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
while (!mXmlReader->atEnd())
|
|
||||||
{
|
|
||||||
switch (mXmlReader->readNext())
|
|
||||||
{
|
{
|
||||||
case QXmlStreamReader::StartElement:
|
case QXmlStreamReader::StartElement:
|
||||||
if (mXmlReader->name() == ResultElementName)
|
if (reader.name() == ResultElementName)
|
||||||
insideResults = true;
|
|
||||||
|
|
||||||
// Read error element from inside result element
|
|
||||||
if (insideResults && mXmlReader->name() == ErrorElementName)
|
|
||||||
{
|
{
|
||||||
ErrorLine line = ReadError(mXmlReader);
|
QXmlStreamAttributes attribs = reader.attributes();
|
||||||
errors.append(line);
|
if (attribs.hasAttribute(QString(VersionAttribute)))
|
||||||
|
{
|
||||||
|
int ver = attribs.value("", VersionAttribute).toString().toInt();
|
||||||
|
return ver;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QXmlStreamReader::EndElement:
|
|
||||||
if (mXmlReader->name() == ResultElementName)
|
|
||||||
insideResults = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Not handled
|
// Not handled
|
||||||
|
case QXmlStreamReader::EndElement:
|
||||||
case QXmlStreamReader::NoToken:
|
case QXmlStreamReader::NoToken:
|
||||||
case QXmlStreamReader::Invalid:
|
case QXmlStreamReader::Invalid:
|
||||||
case QXmlStreamReader::StartDocument:
|
case QXmlStreamReader::StartDocument:
|
||||||
|
@ -146,30 +94,5 @@ QList<ErrorLine> XmlReport::Read()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return errors;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
ErrorLine XmlReport::ReadError(QXmlStreamReader *reader)
|
|
||||||
{
|
|
||||||
ErrorLine line;
|
|
||||||
if (reader->name().toString() == ErrorElementName)
|
|
||||||
{
|
|
||||||
QXmlStreamAttributes attribs = reader->attributes();
|
|
||||||
line.file = attribs.value("", FilenameAttribute).toString();
|
|
||||||
line.line = attribs.value("", LineAttribute).toString().toUInt();
|
|
||||||
line.id = attribs.value("", IdAttribute).toString();
|
|
||||||
line.severity = attribs.value("", SeverityAttribute).toString();
|
|
||||||
|
|
||||||
// NOTE: This dublicates the message to Summary-field. But since
|
|
||||||
// old XML format doesn't have separate summary and verbose messages
|
|
||||||
// we must add same message to both data so it shows up in GUI.
|
|
||||||
// Check if there is full stop and cut the summary to it.
|
|
||||||
QString summary = attribs.value("", MsgAttribute).toString();
|
|
||||||
const int ind = summary.indexOf('.');
|
|
||||||
if (ind != -1)
|
|
||||||
summary = summary.left(ind + 1);
|
|
||||||
line.summary = summary;
|
|
||||||
line.message = attribs.value("", MsgAttribute).toString();
|
|
||||||
}
|
|
||||||
return line;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,78 +19,51 @@
|
||||||
#ifndef XML_REPORT_H
|
#ifndef XML_REPORT_H
|
||||||
#define XML_REPORT_H
|
#define XML_REPORT_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QList>
|
||||||
#include <QFile>
|
|
||||||
#include <QXmlStreamReader>
|
|
||||||
#include <QXmlStreamWriter>
|
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
|
#include "erroritem.h"
|
||||||
|
|
||||||
|
class QObject;
|
||||||
|
|
||||||
/// @addtogroup GUI
|
/// @addtogroup GUI
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief XML file report.
|
* @brief Base class for XML report classes.
|
||||||
* This report outputs XML-formatted report. The XML format must match command
|
|
||||||
* line version's XML output.
|
|
||||||
*/
|
*/
|
||||||
class XmlReport : public Report
|
class XmlReport : public Report
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XmlReport(const QString &filename, QObject * parent = 0);
|
XmlReport(const QString &filename, QObject * parent = 0);
|
||||||
virtual ~XmlReport();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create the report (file).
|
* @brief Read contents of the report file.
|
||||||
* @return true if succeeded, false if file could not be created.
|
*/
|
||||||
*/
|
virtual QList<ErrorItem> Read() = 0;
|
||||||
virtual bool Create();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Open existing report file.
|
* @brief Quote the message.
|
||||||
*/
|
* @param message Message to quote.
|
||||||
bool Open();
|
* @return quoted message.
|
||||||
|
*/
|
||||||
|
static QString quoteMessage(const QString &message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write report header.
|
* @brief Unquote the message.
|
||||||
*/
|
* @param message Message to quote.
|
||||||
virtual void WriteHeader();
|
* @return quoted message.
|
||||||
|
*/
|
||||||
|
static QString unquoteMessage(const QString &message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write report footer.
|
* @brief Get the XML report format version from the file.
|
||||||
*/
|
* @param filename Filename of the report file.
|
||||||
virtual void WriteFooter();
|
* @return XML report format version or 0 if error happened.
|
||||||
|
*/
|
||||||
/**
|
static int determineVersion(const QString &filename);
|
||||||
* @brief Write error to report.
|
|
||||||
* @param error Error data.
|
|
||||||
*/
|
|
||||||
virtual void WriteError(const ErrorItem &error);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Read contents of the report file.
|
|
||||||
*/
|
|
||||||
QList<ErrorLine> Read();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* @brief Read and parse error item from XML stream.
|
|
||||||
* @param reader XML stream reader to use.
|
|
||||||
*/
|
|
||||||
ErrorLine ReadError(QXmlStreamReader *reader);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief XML stream reader for reading the report in XML format.
|
|
||||||
*/
|
|
||||||
QXmlStreamReader *mXmlReader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief XML stream writer for writing the report in XML format.
|
|
||||||
*/
|
|
||||||
QXmlStreamWriter *mXmlWriter;
|
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
#endif // XML_REPORT_H
|
#endif // XML_REPORT_H
|
||||||
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
/*
|
||||||
|
* Cppcheck - A tool for static C/C++ code analysis
|
||||||
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QList>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "report.h"
|
||||||
|
#include "erroritem.h"
|
||||||
|
#include "xmlreport.h"
|
||||||
|
#include "xmlreportv1.h"
|
||||||
|
|
||||||
|
static const char ResultElementName[] = "results";
|
||||||
|
static const char ErrorElementName[] = "error";
|
||||||
|
static const char FilenameAttribute[] = "file";
|
||||||
|
static const char LineAttribute[] = "line";
|
||||||
|
static const char IdAttribute[] = "id";
|
||||||
|
static const char SeverityAttribute[] = "severity";
|
||||||
|
static const char MsgAttribute[] = "msg";
|
||||||
|
|
||||||
|
XmlReportV1::XmlReportV1(const QString &filename, QObject * parent) :
|
||||||
|
XmlReport(filename, parent),
|
||||||
|
mXmlReader(NULL),
|
||||||
|
mXmlWriter(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlReportV1::~XmlReportV1()
|
||||||
|
{
|
||||||
|
delete mXmlReader;
|
||||||
|
delete mXmlWriter;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XmlReportV1::Create()
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
if (Report::Create())
|
||||||
|
{
|
||||||
|
mXmlWriter = new QXmlStreamWriter(Report::GetFile());
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XmlReportV1::Open()
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
if (Report::Open())
|
||||||
|
{
|
||||||
|
mXmlReader = new QXmlStreamReader(Report::GetFile());
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV1::WriteHeader()
|
||||||
|
{
|
||||||
|
mXmlWriter->setAutoFormatting(true);
|
||||||
|
mXmlWriter->writeStartDocument();
|
||||||
|
mXmlWriter->writeStartElement(ResultElementName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV1::WriteFooter()
|
||||||
|
{
|
||||||
|
mXmlWriter->writeEndElement();
|
||||||
|
mXmlWriter->writeEndDocument();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV1::WriteError(const ErrorItem &error)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Error example from the core program in xml
|
||||||
|
<error file="gui/test.cpp" line="14" id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"/>
|
||||||
|
The callstack seems to be ignored here as well, instead last item of the stack is used
|
||||||
|
*/
|
||||||
|
|
||||||
|
mXmlWriter->writeStartElement(ErrorElementName);
|
||||||
|
QString file = QDir::toNativeSeparators(error.files[error.files.size() - 1]);
|
||||||
|
file = XmlReport::quoteMessage(file);
|
||||||
|
mXmlWriter->writeAttribute(FilenameAttribute, file);
|
||||||
|
const QString line = QString::number(error.lines[error.lines.size() - 1]);
|
||||||
|
mXmlWriter->writeAttribute(LineAttribute, line);
|
||||||
|
mXmlWriter->writeAttribute(IdAttribute, error.id);
|
||||||
|
mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
|
||||||
|
const QString message = XmlReport::quoteMessage(error.message);
|
||||||
|
mXmlWriter->writeAttribute(MsgAttribute, message);
|
||||||
|
mXmlWriter->writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ErrorItem> XmlReportV1::Read()
|
||||||
|
{
|
||||||
|
QList<ErrorItem> errors;
|
||||||
|
bool insideResults = false;
|
||||||
|
if (!mXmlReader)
|
||||||
|
{
|
||||||
|
qDebug() << "You must Open() the file before reading it!";
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
while (!mXmlReader->atEnd())
|
||||||
|
{
|
||||||
|
switch (mXmlReader->readNext())
|
||||||
|
{
|
||||||
|
case QXmlStreamReader::StartElement:
|
||||||
|
if (mXmlReader->name() == ResultElementName)
|
||||||
|
insideResults = true;
|
||||||
|
|
||||||
|
// Read error element from inside result element
|
||||||
|
if (insideResults && mXmlReader->name() == ErrorElementName)
|
||||||
|
{
|
||||||
|
ErrorItem item = ReadError(mXmlReader);
|
||||||
|
errors.append(item);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QXmlStreamReader::EndElement:
|
||||||
|
if (mXmlReader->name() == ResultElementName)
|
||||||
|
insideResults = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Not handled
|
||||||
|
case QXmlStreamReader::NoToken:
|
||||||
|
case QXmlStreamReader::Invalid:
|
||||||
|
case QXmlStreamReader::StartDocument:
|
||||||
|
case QXmlStreamReader::EndDocument:
|
||||||
|
case QXmlStreamReader::Characters:
|
||||||
|
case QXmlStreamReader::Comment:
|
||||||
|
case QXmlStreamReader::DTD:
|
||||||
|
case QXmlStreamReader::EntityReference:
|
||||||
|
case QXmlStreamReader::ProcessingInstruction:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorItem XmlReportV1::ReadError(QXmlStreamReader *reader)
|
||||||
|
{
|
||||||
|
ErrorItem item;
|
||||||
|
if (reader->name().toString() == ErrorElementName)
|
||||||
|
{
|
||||||
|
QXmlStreamAttributes attribs = reader->attributes();
|
||||||
|
QString file = attribs.value("", FilenameAttribute).toString();
|
||||||
|
file = XmlReport::unquoteMessage(file);
|
||||||
|
item.file = file;
|
||||||
|
item.files.push_back(file);
|
||||||
|
const int line = attribs.value("", LineAttribute).toString().toUInt();
|
||||||
|
item.lines.push_back(line);
|
||||||
|
item.id = attribs.value("", IdAttribute).toString();
|
||||||
|
item.severity = attribs.value("", SeverityAttribute).toString();
|
||||||
|
|
||||||
|
// NOTE: This dublicates the message to Summary-field. But since
|
||||||
|
// old XML format doesn't have separate summary and verbose messages
|
||||||
|
// we must add same message to both data so it shows up in GUI.
|
||||||
|
// Check if there is full stop and cut the summary to it.
|
||||||
|
QString summary = attribs.value("", MsgAttribute).toString();
|
||||||
|
const int ind = summary.indexOf('.');
|
||||||
|
if (ind != -1)
|
||||||
|
summary = summary.left(ind + 1);
|
||||||
|
item.summary = XmlReport::unquoteMessage(summary);
|
||||||
|
QString message = attribs.value("", MsgAttribute).toString();
|
||||||
|
item.message = XmlReport::unquoteMessage(message);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
* Cppcheck - A tool for static C/C++ code analysis
|
||||||
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XML_REPORTV1_H
|
||||||
|
#define XML_REPORTV1_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
#include "xmlreport.h"
|
||||||
|
|
||||||
|
/// @addtogroup GUI
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief XML file report version 1.
|
||||||
|
* This report outputs XML-formatted report, version 1. The XML format must match command
|
||||||
|
* line version's XML output.
|
||||||
|
*/
|
||||||
|
class XmlReportV1 : public XmlReport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XmlReportV1(const QString &filename, QObject * parent = 0);
|
||||||
|
virtual ~XmlReportV1();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create the report (file).
|
||||||
|
* @return true if succeeded, false if file could not be created.
|
||||||
|
*/
|
||||||
|
virtual bool Create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Open existing report file.
|
||||||
|
*/
|
||||||
|
bool Open();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write report header.
|
||||||
|
*/
|
||||||
|
virtual void WriteHeader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write report footer.
|
||||||
|
*/
|
||||||
|
virtual void WriteFooter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write error to report.
|
||||||
|
* @param error Error data.
|
||||||
|
*/
|
||||||
|
virtual void WriteError(const ErrorItem &error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read contents of the report file.
|
||||||
|
*/
|
||||||
|
virtual QList<ErrorItem> Read();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Read and parse error item from XML stream.
|
||||||
|
* @param reader XML stream reader to use.
|
||||||
|
*/
|
||||||
|
ErrorItem ReadError(QXmlStreamReader *reader);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief XML stream reader for reading the report in XML format.
|
||||||
|
*/
|
||||||
|
QXmlStreamReader *mXmlReader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief XML stream writer for writing the report in XML format.
|
||||||
|
*/
|
||||||
|
QXmlStreamWriter *mXmlWriter;
|
||||||
|
};
|
||||||
|
/// @}
|
||||||
|
#endif // XML_REPORTV1_H
|
|
@ -0,0 +1,249 @@
|
||||||
|
/*
|
||||||
|
* Cppcheck - A tool for static C/C++ code analysis
|
||||||
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QList>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "report.h"
|
||||||
|
#include "erroritem.h"
|
||||||
|
#include "xmlreport.h"
|
||||||
|
#include "xmlreportv2.h"
|
||||||
|
#include "cppcheck.h"
|
||||||
|
|
||||||
|
static const char ResultElementName[] = "results";
|
||||||
|
static const char CppcheckElementName[] = "cppcheck";
|
||||||
|
static const char ErrorElementName[] = "error";
|
||||||
|
static const char ErrorsElementName[] = "errors";
|
||||||
|
static const char LocationElementName[] = "location";
|
||||||
|
static const char FilenameAttribute[] = "file";
|
||||||
|
static const char LineAttribute[] = "line";
|
||||||
|
static const char IdAttribute[] = "id";
|
||||||
|
static const char SeverityAttribute[] = "severity";
|
||||||
|
static const char MsgAttribute[] = "msg";
|
||||||
|
static const char VersionAttribute[] = "version";
|
||||||
|
static const char VerboseAttribute[] = "verbose";
|
||||||
|
|
||||||
|
XmlReportV2::XmlReportV2(const QString &filename, QObject * parent) :
|
||||||
|
XmlReport(filename, parent),
|
||||||
|
mXmlReader(NULL),
|
||||||
|
mXmlWriter(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlReportV2::~XmlReportV2()
|
||||||
|
{
|
||||||
|
delete mXmlReader;
|
||||||
|
delete mXmlWriter;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XmlReportV2::Create()
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
if (Report::Create())
|
||||||
|
{
|
||||||
|
mXmlWriter = new QXmlStreamWriter(Report::GetFile());
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XmlReportV2::Open()
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
if (Report::Open())
|
||||||
|
{
|
||||||
|
mXmlReader = new QXmlStreamReader(Report::GetFile());
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV2::WriteHeader()
|
||||||
|
{
|
||||||
|
mXmlWriter->setAutoFormatting(true);
|
||||||
|
mXmlWriter->writeStartDocument();
|
||||||
|
mXmlWriter->writeStartElement(ResultElementName);
|
||||||
|
mXmlWriter->writeAttribute(VersionAttribute, QString::number(2));
|
||||||
|
mXmlWriter->writeStartElement(CppcheckElementName);
|
||||||
|
mXmlWriter->writeAttribute(VersionAttribute, QString(CppCheck::version()));
|
||||||
|
mXmlWriter->writeEndElement();
|
||||||
|
mXmlWriter->writeStartElement(ErrorsElementName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV2::WriteFooter()
|
||||||
|
{
|
||||||
|
mXmlWriter->writeEndElement(); // errors
|
||||||
|
mXmlWriter->writeEndElement(); // results
|
||||||
|
mXmlWriter->writeEndDocument();
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV2::WriteError(const ErrorItem &error)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Error example from the core program in xml
|
||||||
|
<error id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"
|
||||||
|
verbose="Mismatching allocation and deallocation: k">
|
||||||
|
<location file="..\..\test\test.cxx" line="16"/>
|
||||||
|
<location file="..\..\test\test.cxx" line="32"/>
|
||||||
|
</error>
|
||||||
|
*/
|
||||||
|
|
||||||
|
mXmlWriter->writeStartElement(ErrorElementName);
|
||||||
|
mXmlWriter->writeAttribute(IdAttribute, error.id);
|
||||||
|
mXmlWriter->writeAttribute(SeverityAttribute, error.severity);
|
||||||
|
const QString summary = XmlReport::quoteMessage(error.summary);
|
||||||
|
mXmlWriter->writeAttribute(MsgAttribute, summary);
|
||||||
|
const QString message = XmlReport::quoteMessage(error.message);
|
||||||
|
mXmlWriter->writeAttribute(VerboseAttribute, message);
|
||||||
|
|
||||||
|
for (int i = 0; i < error.files.count(); i++)
|
||||||
|
{
|
||||||
|
mXmlWriter->writeStartElement(LocationElementName);
|
||||||
|
|
||||||
|
QString file = QDir::toNativeSeparators(error.files[i]);
|
||||||
|
file = XmlReport::quoteMessage(file);
|
||||||
|
mXmlWriter->writeAttribute(FilenameAttribute, file);
|
||||||
|
const QString line = QString::number(error.lines[i]);
|
||||||
|
mXmlWriter->writeAttribute(LineAttribute, line);
|
||||||
|
|
||||||
|
mXmlWriter->writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
mXmlWriter->writeEndElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<ErrorItem> XmlReportV2::Read()
|
||||||
|
{
|
||||||
|
QList<ErrorItem> errors;
|
||||||
|
bool insideResults = false;
|
||||||
|
if (!mXmlReader)
|
||||||
|
{
|
||||||
|
qDebug() << "You must Open() the file before reading it!";
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
while (!mXmlReader->atEnd())
|
||||||
|
{
|
||||||
|
switch (mXmlReader->readNext())
|
||||||
|
{
|
||||||
|
case QXmlStreamReader::StartElement:
|
||||||
|
if (mXmlReader->name() == ResultElementName)
|
||||||
|
insideResults = true;
|
||||||
|
|
||||||
|
// Read error element from inside result element
|
||||||
|
if (insideResults && mXmlReader->name() == ErrorElementName)
|
||||||
|
{
|
||||||
|
ErrorItem item = ReadError(mXmlReader);
|
||||||
|
errors.append(item);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QXmlStreamReader::EndElement:
|
||||||
|
if (mXmlReader->name() == ResultElementName)
|
||||||
|
insideResults = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Not handled
|
||||||
|
case QXmlStreamReader::NoToken:
|
||||||
|
case QXmlStreamReader::Invalid:
|
||||||
|
case QXmlStreamReader::StartDocument:
|
||||||
|
case QXmlStreamReader::EndDocument:
|
||||||
|
case QXmlStreamReader::Characters:
|
||||||
|
case QXmlStreamReader::Comment:
|
||||||
|
case QXmlStreamReader::DTD:
|
||||||
|
case QXmlStreamReader::EntityReference:
|
||||||
|
case QXmlStreamReader::ProcessingInstruction:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Error example from the core program in xml
|
||||||
|
<error id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"
|
||||||
|
verbose="Mismatching allocation and deallocation: k">
|
||||||
|
<location file="..\..\test\test.cxx" line="16"/>
|
||||||
|
<location file="..\..\test\test.cxx" line="32"/>
|
||||||
|
</error>
|
||||||
|
*/
|
||||||
|
|
||||||
|
ErrorItem item;
|
||||||
|
if (reader->name().toString() == ErrorElementName)
|
||||||
|
{
|
||||||
|
QXmlStreamAttributes attribs = reader->attributes();
|
||||||
|
item.id = attribs.value("", IdAttribute).toString();
|
||||||
|
item.severity = attribs.value("", SeverityAttribute).toString();
|
||||||
|
const QString summary = attribs.value("", MsgAttribute).toString();
|
||||||
|
item.summary = XmlReport::unquoteMessage(summary);
|
||||||
|
const QString message = attribs.value("", VerboseAttribute).toString();
|
||||||
|
item.message = XmlReport::unquoteMessage(message);
|
||||||
|
|
||||||
|
ReadLocations(item);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
void XmlReportV2::ReadLocations(ErrorItem &item)
|
||||||
|
{
|
||||||
|
QList<ErrorItem> errors;
|
||||||
|
bool allRead = false;
|
||||||
|
while (!allRead && !mXmlReader->atEnd())
|
||||||
|
{
|
||||||
|
switch (mXmlReader->readNext())
|
||||||
|
{
|
||||||
|
case QXmlStreamReader::StartElement:
|
||||||
|
if (mXmlReader->name() != LocationElementName)
|
||||||
|
continue; // Skip other than location elements
|
||||||
|
{
|
||||||
|
QXmlStreamAttributes attribs = mXmlReader->attributes();
|
||||||
|
QString file = attribs.value("", FilenameAttribute).toString();
|
||||||
|
file = XmlReport::unquoteMessage(file);
|
||||||
|
if (item.file.isEmpty())
|
||||||
|
item.file = file;
|
||||||
|
item.files.push_back(file);
|
||||||
|
const int line = attribs.value("", LineAttribute).toString().toUInt();
|
||||||
|
item.lines.push_back(line);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QXmlStreamReader::EndElement:
|
||||||
|
if (mXmlReader->name() == LocationElementName)
|
||||||
|
allRead = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Not handled
|
||||||
|
case QXmlStreamReader::NoToken:
|
||||||
|
case QXmlStreamReader::Invalid:
|
||||||
|
case QXmlStreamReader::StartDocument:
|
||||||
|
case QXmlStreamReader::EndDocument:
|
||||||
|
case QXmlStreamReader::Characters:
|
||||||
|
case QXmlStreamReader::Comment:
|
||||||
|
case QXmlStreamReader::DTD:
|
||||||
|
case QXmlStreamReader::EntityReference:
|
||||||
|
case QXmlStreamReader::ProcessingInstruction:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Cppcheck - A tool for static C/C++ code analysis
|
||||||
|
* Copyright (C) 2007-2011 Daniel Marjamäki and Cppcheck team.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef XML_REPORTV2_H
|
||||||
|
#define XML_REPORTV2_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include <QXmlStreamWriter>
|
||||||
|
#include "report.h"
|
||||||
|
|
||||||
|
/// @addtogroup GUI
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief XML file report version 2.
|
||||||
|
* This report outputs XML-formatted report. The XML format must match command
|
||||||
|
* line version's XML output.
|
||||||
|
*/
|
||||||
|
class XmlReportV2 : public XmlReport
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
XmlReportV2(const QString &filename, QObject * parent = 0);
|
||||||
|
virtual ~XmlReportV2();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create the report (file).
|
||||||
|
* @return true if succeeded, false if file could not be created.
|
||||||
|
*/
|
||||||
|
virtual bool Create();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Open existing report file.
|
||||||
|
*/
|
||||||
|
bool Open();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write report header.
|
||||||
|
*/
|
||||||
|
virtual void WriteHeader();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write report footer.
|
||||||
|
*/
|
||||||
|
virtual void WriteFooter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Write error to report.
|
||||||
|
* @param error Error data.
|
||||||
|
*/
|
||||||
|
virtual void WriteError(const ErrorItem &error);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read contents of the report file.
|
||||||
|
*/
|
||||||
|
virtual QList<ErrorItem> Read();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Read and parse error item from XML stream.
|
||||||
|
* @param reader XML stream reader to use.
|
||||||
|
*/
|
||||||
|
ErrorItem ReadError(QXmlStreamReader *reader);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Read and parse error items location elements from XML stream.
|
||||||
|
* @param item ErrorItem to write the location data.
|
||||||
|
*/
|
||||||
|
void ReadLocations(ErrorItem &item);
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief XML stream reader for reading the report in XML format.
|
||||||
|
*/
|
||||||
|
QXmlStreamReader *mXmlReader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief XML stream writer for writing the report in XML format.
|
||||||
|
*/
|
||||||
|
QXmlStreamWriter *mXmlWriter;
|
||||||
|
};
|
||||||
|
/// @}
|
||||||
|
#endif // XML_REPORTV2_H
|
Loading…
Reference in New Issue