Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
stat_table_exporter.h
Go to the documentation of this file.
1
11
12#ifndef STAT_TABLE_EXPORTER_H
13#define STAT_TABLE_EXPORTER_H
14
15#include <config.h>
16
17#include <epan/stat_tap_ui.h>
18
19#include <functional>
20
21#include <QByteArray>
22#include <QCoreApplication>
23#include <QList>
24#include <QString>
25#include <QStringList>
26#include <QVariant>
27
28class QWidget;
29
36{
37 Q_DECLARE_TR_FUNCTIONS(StatTableExporter)
38
39public:
43 struct Table {
44 QString title;
45 QString file_name;
46 QStringList headers;
47 QList<QList<QVariant>> rows;
48 };
49
56 static QByteArray toByteArray(st_format_type format, const Table &table);
57
64 static QString plainCell(const QVariant &var, int width = 0);
65
71 static void saveAs(QWidget *parent, std::function<QByteArray(st_format_type)> serialize);
72};
73
74#endif // STAT_TABLE_EXPORTER_H
Serialises a statistics table to plain text, CSV, XML and YAML and saves it to a file.
Definition stat_table_exporter.h:36
static void saveAs(QWidget *parent, std::function< QByteArray(st_format_type)> serialize)
Asks for a file name and format, serialises and writes the file.
Definition stat_table_exporter.cpp:211
static QByteArray toByteArray(st_format_type format, const Table &table)
Serialises a table in the given format.
Definition stat_table_exporter.cpp:58
static QString plainCell(const QVariant &var, int width=0)
Converts a QVariant cell value to a plain-text string.
Definition stat_table_exporter.cpp:29
enum _st_format_type st_format_type
Output format used when saving statistics tree data via "Save As...".
A statistics table: title, headers and one list of cell values per row.
Definition stat_table_exporter.h:43
QStringList headers
Column header texts.
Definition stat_table_exporter.h:46
QList< QList< QVariant > > rows
Cell values per row; empty rows are skipped on export.
Definition stat_table_exporter.h:47
QString title
Table title, usually the window subtitle.
Definition stat_table_exporter.h:44
QString file_name
Display name of the capture file.
Definition stat_table_exporter.h:45