Cppcheck
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
XmlReportV2 Class Reference

XML file report version 2. More...

#include <xmlreportv2.h>

Inheritance diagram for XmlReportV2:
XmlReport Report

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< ErrorItemread () 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ XmlReportV2()

XmlReportV2::XmlReportV2 ( const QString &  filename,
QString  productName 
)
explicit

Definition at line 62 of file xmlreportv2.cpp.

◆ ~XmlReportV2()

XmlReportV2::~XmlReportV2 ( )
override

Definition at line 69 of file xmlreportv2.cpp.

References mXmlReader, and mXmlWriter.

Member Function Documentation

◆ create()

bool XmlReportV2::create ( )
overridevirtual

Create the report (file).

Returns
true if succeeded, false if file could not be created.

Reimplemented from Report.

Definition at line 75 of file xmlreportv2.cpp.

References Report::create(), Report::getFile(), and mXmlWriter.

◆ open()

bool XmlReportV2::open ( )
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().

◆ read()

QList< ErrorItem > XmlReportV2::read ( )
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().

◆ readError()

ErrorItem XmlReportV2::readError ( const QXmlStreamReader *  reader)
protected

◆ writeError()

void XmlReportV2::writeError ( const ErrorItem error)
overridevirtual

◆ writeFooter()

void XmlReportV2::writeFooter ( )
overridevirtual

Write report footer.

Implements Report.

Definition at line 111 of file xmlreportv2.cpp.

References mXmlWriter.

◆ writeHeader()

void XmlReportV2::writeHeader ( )
overridevirtual

Member Data Documentation

◆ mProductName

const QString XmlReportV2::mProductName
private

Product name read from cppcheck.cfg.

Definition at line 86 of file xmlreportv2.h.

Referenced by writeHeader().

◆ mXmlReader

QXmlStreamReader* XmlReportV2::mXmlReader
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().

◆ mXmlWriter

QXmlStreamWriter* XmlReportV2::mXmlWriter
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().


The documentation for this class was generated from the following files: