Cppcheck
printablereport.h
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2024 Cppcheck team.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef PRINTABLE_REPORT_H
20 #define PRINTABLE_REPORT_H
21 
22 #include "report.h"
23 
24 #include <QString>
25 
26 class ErrorItem;
27 
28 /// @addtogroup GUI
29 /// @{
30 
31 
32 /**
33  * @brief Printable (in-memory) report.
34  * This report formats results and exposes them for printing.
35  */
36 class PrintableReport : public Report {
37 public:
39 
40  /**
41  * @brief Create the report (file).
42  * @return true if succeeded, false if file could not be created.
43  */
44  bool create() override;
45 
46  /**
47  * @brief Write report header.
48  */
49  void writeHeader() override;
50 
51  /**
52  * @brief Write report footer.
53  */
54  void writeFooter() override;
55 
56  /**
57  * @brief Write error to report.
58  * @param error Error data.
59  */
60  void writeError(const ErrorItem &error) override;
61 
62  /**
63  * @brief Returns the formatted report.
64  */
65  const QString& getFormattedReportText() const;
66 
67 private:
68 
69  /**
70  * @brief Stores the formatted report contents.
71  */
73 };
74 /// @}
75 #endif // PRINTABLE_REPORT_H
A class containing error data for one error.
Definition: erroritem.h:72
Printable (in-memory) report.
void writeFooter() override
Write report footer.
const QString & getFormattedReportText() const
Returns the formatted report.
void writeError(const ErrorItem &error) override
Write error to report.
void writeHeader() override
Write report header.
QString mFormattedReport
Stores the formatted report contents.
bool create() override
Create the report (file).
A base class for reports.
Definition: report.h:34
@ error
Programming error.