Cppcheck
|
XML file report version 2. More...
#include <xmlreportv2.h>
Public Member Functions | |
XmlReportV2 (const QString &filename, QString productName) | |
~XmlReportV2 () override | |
bool | create () override |
Create the report (file). More... | |
bool | open () override |
Open existing report file. More... | |
void | writeHeader () override |
Write report header. More... | |
void | writeFooter () override |
Write report footer. More... | |
void | writeError (const ErrorItem &error) override |
Write error to report. More... | |
QList< ErrorItem > | read () override |
Read contents of the report file. More... | |
Public Member Functions inherited from XmlReport | |
XmlReport (const QString &filename) | |
Public Member Functions inherited from Report | |
Report (QString filename) | |
~Report () override | |
void | close () |
Close the report (file). More... | |
Protected Member Functions | |
ErrorItem | readError (const QXmlStreamReader *reader) |
Read and parse error item from XML stream. More... | |
Protected Member Functions inherited from Report | |
QFile * | getFile () |
Get the file object where the report is written to. More... | |
Private Attributes | |
const QString | mProductName |
Product name read from cppcheck.cfg. More... | |
QXmlStreamReader * | mXmlReader |
XML stream reader for reading the report in XML format. More... | |
QXmlStreamWriter * | mXmlWriter |
XML stream writer for writing the report in XML format. More... | |
Additional Inherited Members | |
Public Types inherited from Report | |
enum | Type { TXT , XMLV2 , CSV } |
Static Public Member Functions inherited from XmlReport | |
static QString | quoteMessage (const QString &message) |
Quote the message. More... | |
static QString | unquoteMessage (const QString &message) |
Unquote the message. More... | |
static int | determineVersion (const QString &filename) |
Get the XML report format version from the file. More... | |
XML file report version 2.
This report outputs XML-formatted report. The XML format must match command line version's XML output.
Definition at line 40 of file xmlreportv2.h.
|
explicit |
Definition at line 62 of file xmlreportv2.cpp.
|
override |
Definition at line 69 of file xmlreportv2.cpp.
References mXmlReader, and mXmlWriter.
|
overridevirtual |
Create the report (file).
Reimplemented from Report.
Definition at line 75 of file xmlreportv2.cpp.
References Report::create(), Report::getFile(), and mXmlWriter.
|
overridevirtual |
Open existing report file.
Reimplemented from Report.
Definition at line 84 of file xmlreportv2.cpp.
References Report::getFile(), mXmlReader, and Report::open().
Referenced by ResultsView::readErrorsXml(), and ResultsTree::updateFromOldReport().
|
overridevirtual |
Read contents of the report file.
Implements XmlReport.
Definition at line 168 of file xmlreportv2.cpp.
References ErrorElementName, mXmlReader, readError(), and ResultElementName.
Referenced by ResultsView::readErrorsXml(), and ResultsTree::updateFromOldReport().
|
protected |
Read and parse error item from XML stream.
reader | XML stream reader to use. |
Definition at line 210 of file xmlreportv2.cpp.
References QErrorPathItem::column, ColumnAttribute, ErrorItem::cwe, CWEAttribute, ErrorElementName, ErrorItem::errorId, ErrorItem::errorPath, QErrorPathItem::file, ErrorItem::file0, FilenameAttribute, GuiSeverity::fromString(), ErrorItem::hash, HashAttribute, IdAttribute, IncludedFromFilenameAttribute, ErrorItem::inconclusive, InconclusiveAttribute, QErrorPathItem::info, InfoAttribute, QErrorPathItem::line, LineAttribute, LocationElementName, ErrorItem::message, MsgAttribute, mXmlReader, ErrorItem::severity, SeverityAttribute, ErrorItem::sinceDate, SinceDateAttribute, ErrorItem::summary, ErrorItem::tags, TagsAttribute, toString(), XmlReport::unquoteMessage(), and VerboseAttribute.
Referenced by read().
|
overridevirtual |
Write error to report.
error | Error data. |
Implements Report.
Definition at line 118 of file xmlreportv2.cpp.
References ColumnAttribute, CWEAttribute, error, ErrorElementName, FilenameAttribute, HashAttribute, IdAttribute, IncludedFromFilenameAttribute, InconclusiveAttribute, InfoAttribute, LineAttribute, LocationElementName, MsgAttribute, mXmlWriter, XmlReport::quoteMessage(), SeverityAttribute, SinceDateAttribute, TagsAttribute, GuiSeverity::toString(), and VerboseAttribute.
|
overridevirtual |
Write report footer.
Implements Report.
Definition at line 111 of file xmlreportv2.cpp.
References mXmlWriter.
|
overridevirtual |
Write report header.
Implements Report.
Definition at line 93 of file xmlreportv2.cpp.
References CppcheckElementName, ErrorsElementName, Settings::getNameAndVersion(), mProductName, mXmlWriter, ProductNameAttribute, ResultElementName, CppCheck::version(), and VersionAttribute.
|
private |
Product name read from cppcheck.cfg.
Definition at line 86 of file xmlreportv2.h.
Referenced by writeHeader().
|
private |
XML stream reader for reading the report in XML format.
Definition at line 91 of file xmlreportv2.h.
Referenced by open(), read(), readError(), and ~XmlReportV2().
|
private |
XML stream writer for writing the report in XML format.
Definition at line 96 of file xmlreportv2.h.
Referenced by create(), writeError(), writeFooter(), writeHeader(), and ~XmlReportV2().