Wireshark 5.1.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
StatTableExporter Class Reference

Serialises a statistics table to plain text, CSV, XML and YAML and saves it to a file. More...

#include <stat_table_exporter.h>

Classes

struct  Table
 A statistics table: title, headers and one list of cell values per row. More...

Static Public Member Functions

static QByteArray toByteArray (st_format_type format, const Table &table)
 Serialises a table in the given format.
static QString plainCell (const QVariant &var, int width=0)
 Converts a QVariant cell value to a plain-text string.
static void saveAs (QWidget *parent, std::function< QByteArray(st_format_type)> serialize)
 Asks for a file name and format, serialises and writes the file.

Detailed Description

Serialises a statistics table to plain text, CSV, XML and YAML and saves it to a file.

Shared by TapParameterDialog and the Distribution dialog so both produce identical output.

Member Function Documentation

◆ plainCell()

QString StatTableExporter::plainCell ( const QVariant & var,
int width = 0 )
static

Converts a QVariant cell value to a plain-text string.

Parameters
varThe QVariant value to convert.
widthMinimum field width for padding; 0 for no padding.
Returns
Plain-text representation of var.

◆ saveAs()

void StatTableExporter::saveAs ( QWidget * parent,
std::function< QByteArray(st_format_type)> serialize )
static

Asks for a file name and format, serialises and writes the file.

Parameters
parentParent widget of the file dialog and the error box.
serializeCalled with the chosen format to produce the file contents.

◆ toByteArray()

QByteArray StatTableExporter::toByteArray ( st_format_type format,
const Table & table )
static

Serialises a table in the given format.

Parameters
formatTarget format (plain text, CSV, XML or YAML).
tableThe table to serialise.
Returns
The serialised table.

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