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

CSV text file report. More...

#include <csvreport.h>

Inheritance diagram for CsvReport:
Report

Public Member Functions

 CsvReport (const QString &filename)
 
bool create () override
 Create the 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...
 
- Public Member Functions inherited from Report
 Report (QString filename)
 
 ~Report () override
 
virtual bool open ()
 Open the existing report (file). More...
 
void close ()
 Close the report (file). More...
 

Private Attributes

QTextStream mTxtWriter
 Text stream writer for writing the report in text format. More...
 

Additional Inherited Members

- Public Types inherited from Report
enum  Type { TXT , XMLV2 , CSV }
 
- Protected Member Functions inherited from Report
QFile * getFile ()
 Get the file object where the report is written to. More...
 

Detailed Description

CSV text file report.

This report exports results as CSV (comma separated values). CSV files are easy to import to many other programs.

Todo:
This class should be inherited from TxtReport?

Definition at line 39 of file csvreport.h.

Constructor & Destructor Documentation

◆ CsvReport()

CsvReport::CsvReport ( const QString &  filename)
explicit

Definition at line 29 of file csvreport.cpp.

Member Function Documentation

◆ create()

bool CsvReport::create ( )
overridevirtual

Create the report (file).

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

Reimplemented from Report.

Definition at line 33 of file csvreport.cpp.

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

◆ writeError()

void CsvReport::writeError ( const ErrorItem error)
overridevirtual

Write error to report.

Parameters
errorError data.

Implements Report.

Definition at line 57 of file csvreport.cpp.

References error, mTxtWriter, and GuiSeverity::toString().

◆ writeFooter()

void CsvReport::writeFooter ( )
overridevirtual

Write report footer.

Implements Report.

Definition at line 52 of file csvreport.cpp.

◆ writeHeader()

void CsvReport::writeHeader ( )
overridevirtual

Write report header.

Implements Report.

Definition at line 42 of file csvreport.cpp.

References mTxtWriter.

Member Data Documentation

◆ mTxtWriter

QTextStream CsvReport::mTxtWriter
private

Text stream writer for writing the report in text format.

Definition at line 70 of file csvreport.h.

Referenced by create(), writeError(), and writeHeader().


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