v2.0.0
Loading...
Searching...
No Matches
report.h
Go to the documentation of this file.
1//=============================================================================================================
25
26#ifndef REPORT_UTILS_H
27#define REPORT_UTILS_H
28
29//=============================================================================================================
30// INCLUDES
31//=============================================================================================================
32
33#include "utils_global.h"
34
35//=============================================================================================================
36// QT INCLUDES
37//=============================================================================================================
38
39#include <QString>
40#include <QStringList>
41#include <QList>
42#include <QPair>
43
44//=============================================================================================================
45// DEFINE NAMESPACE UTILSLIB
46//=============================================================================================================
47
48namespace UTILSLIB
49{
50
51//=============================================================================================================
56{
57 QString title;
58 QString htmlContent;
59};
60
61//=============================================================================================================
75{
76public:
77 //=========================================================================================================
81 explicit Report(const QString& sTitle = "MNE-CPP Report");
82
83 //=========================================================================================================
90 void addText(const QString& sTitle, const QString& sContent);
91
92 //=========================================================================================================
100 void addTable(const QString& sTitle,
101 const QStringList& headers,
102 const QList<QStringList>& rows);
103
104 //=========================================================================================================
111 void addKeyValue(const QString& sTitle,
112 const QList<QPair<QString, QString>>& pairs);
113
114 //=========================================================================================================
118 void addCode(const QString& sTitle, const QString& sCode);
119
120 //=========================================================================================================
124 int sectionCount() const { return m_sections.size(); }
125
126 //=========================================================================================================
130 QString toHtml() const;
131
132 //=========================================================================================================
140 bool save(const QString& sPath) const;
141
142 //=========================================================================================================
146 const QString& title() const { return m_sTitle; }
147
148private:
149 QString m_sTitle;
150 QList<ReportSection> m_sections;
151};
152
153} // namespace UTILSLIB
154
155#endif // REPORT_UTILS_H
Public umbrella header for UTILSLIB exposing the UTILSSHARED_EXPORT macro and build-info accessors.
#define UTILSSHARED_EXPORT
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
A section in the report (title + HTML content).
Definition report.h:56
Report(const QString &sTitle="MNE-CPP Report")
Construct a report with a title.
Definition report.cpp:45
void addCode(const QString &sTitle, const QString &sCode)
Add a preformatted code block.
Definition report.cpp:107
const QString & title() const
Get the report title.
Definition report.h:146
void addKeyValue(const QString &sTitle, const QList< QPair< QString, QString > > &pairs)
Add a key-value section.
Definition report.cpp:89
void addText(const QString &sTitle, const QString &sContent)
Add a text section.
Definition report.cpp:52
int sectionCount() const
Get the number of sections.
Definition report.h:124
void addTable(const QString &sTitle, const QStringList &headers, const QList< QStringList > &rows)
Add a table section.
Definition report.cpp:62