Cppcheck
xmlreport.h
Go to the documentation of this file.
1 /*
2  * Cppcheck - A tool for static C/C++ code analysis
3  * Copyright (C) 2007-2022 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 XML_REPORT_H
20 #define XML_REPORT_H
21 
22 #include "report.h"
23 
24 #include <QString>
25 #include <QList>
26 
27 class ErrorItem;
28 
29 /// @addtogroup GUI
30 /// @{
31 
32 
33 /**
34  * @brief Base class for XML report classes.
35  */
36 class XmlReport : public Report {
37 public:
38  explicit XmlReport(const QString &filename);
39 
40  /**
41  * @brief Read contents of the report file.
42  */
43  virtual QList<ErrorItem> read() = 0;
44 
45  /**
46  * @brief Quote the message.
47  * @param message Message to quote.
48  * @return quoted message.
49  */
50  static QString quoteMessage(const QString &message);
51 
52  /**
53  * @brief Unquote the message.
54  * @param message Message to quote.
55  * @return quoted message.
56  */
57  static QString unquoteMessage(const QString &message);
58 
59  /**
60  * @brief Get the XML report format version from the file.
61  * @param filename Filename of the report file.
62  * @return XML report format version or 0 if error happened.
63  */
64  static int determineVersion(const QString &filename);
65 };
66 /// @}
67 
68 #endif // XML_REPORT_H
A class containing error data for one error.
Definition: erroritem.h:72
A base class for reports.
Definition: report.h:34
Base class for XML report classes.
Definition: xmlreport.h:36
XmlReport(const QString &filename)
Definition: xmlreport.cpp:35
virtual QList< ErrorItem > read()=0
Read contents of the report file.
static QString quoteMessage(const QString &message)
Quote the message.
Definition: xmlreport.cpp:39
static QString unquoteMessage(const QString &message)
Unquote the message.
Definition: xmlreport.cpp:50
static int determineVersion(const QString &filename)
Get the XML report format version from the file.
Definition: xmlreport.cpp:61