Qx v0.5.8
Qt Extensions Library
|
The DsvTable class provides a mutable representation of delimiter-separated values. More...
#include <qx/core/qx-dsvtable.h>
Public Member Functions | |
DsvTable () | |
DsvTable (QSize size) | |
DsvTable (QSize size, const QVariant &value) | |
DsvTable (std::initializer_list< std::initializer_list< QVariant > > table) | |
QByteArray | toDsv (QChar delim=',', QChar esc='"') |
Public Member Functions inherited from Qx::Table< QVariant > | |
Table () | |
Table (QSize size) | |
Table (QSize size, const QVariant &value) | |
Table (std::initializer_list< std::initializer_list< QVariant > > table) | |
void | addColumns (qsizetype c) |
void | addRows (qsizetype r) |
void | appendColumn (const QList< QVariant > &c) |
void | appendRow (const QList< QVariant > &r) |
QVariant & | at (qsizetype r, qsizetype c) |
const QVariant & | at (qsizetype r, qsizetype c) const |
QSize | capacity () const |
QList< QVariant > | columnAt (qsizetype i) const |
qsizetype | columnCount () const |
void | fill (const QVariant &value, QSize size) |
QList< QVariant > | firstColumn () const |
const QList< QVariant > & | firstRow () const |
qsizetype | height () const |
void | insertColumn (qsizetype i, const QList< QVariant > &c) |
void | insertRow (qsizetype i, const QList< QVariant > &r) |
bool | isEmpty () const |
QList< QVariant > | lastColumn () const |
const QList< QVariant > & | lastRow () const |
bool | operator!= (const Table &other) const |
bool | operator== (const Table &other) const |
void | removeColumnAt (qsizetype i) |
void | removeColumns (qsizetype i, qsizetype n=1) |
void | removeFirstColumn () |
void | removeFirstRow () |
void | removeLastColumn () |
void | removeLastRow () |
void | removeRowAt (qsizetype i) |
void | removeRows (qsizetype i, qsizetype n=1) |
void | replaceColumn (qsizetype i, const QList< QVariant > &c) |
void | replaceRow (qsizetype i, const QList< QVariant > &r) |
void | reserve (QSize size) |
void | resize (QSize size) |
void | resizeColumns (qsizetype size) |
void | resizeRows (qsizetype size) |
const QList< QVariant > & | rowAt (qsizetype i) const |
row_iterator | rowBegin () const |
qsizetype | rowCount () const |
row_iterator | rowEnd () const |
Table | section (qsizetype r, qsizetype c, qsizetype height, qsizetype width) const |
QSize | size () const |
void | squeeze () |
QList< QVariant > | takeColumnAt (qsizetype i) |
QList< QVariant > | takeFirstColumn () |
QList< QVariant > | takeFirstRow () |
QList< QVariant > | takeLastColumn () |
QList< QVariant > | takeLastRow () |
QList< QVariant > | takeRowAt (qsizetype i) |
QVariant | value (qsizetype r, qsizetype c) const |
QVariant | value (qsizetype r, qsizetype c, const QVariant &defaultValue) const |
qsizetype | width () const |
Static Public Member Functions | |
static DsvTable | fromDsv (const QByteArray &dsv, QChar delim=',', QChar esc='"', DsvParseError* error = nullptr) |
Additional Inherited Members | |
Public Types inherited from Qx::Table< QVariant > | |
typedef QList< QList< QVariant > >::const_iterator | row_iterator |
Protected Attributes inherited from Qx::Table< QVariant > | |
QList< QList< QVariant > > | mTable |
Delimiter-separated values is a format for storing two-dimensional arrays of arbitrary data by separating the fields in each row with a given delimiter character, and separating each row via a line break.
DSV is human readable, flexible, and widely supported.
The most common form of DSV, CSV, uses the comma character ,
as the delimiter.
DsvTable provides a variety of methods for data manipulation, as well as RFC4180 compliant parsing and serialization of DSV data via fromDsv() and toDsv().
It's data is stored and accessed as instances of QVariant for convenient conversion of each field to its true data type.
Qx::DsvTable::DsvTable | ( | ) |
Constructs an empty DsvTable.
Qx::DsvTable::DsvTable | ( | QSize | size | ) |
Constructs a DsvTable of size size, with every field set to value.
Qx::DsvTable::DsvTable | ( | std::initializer_list< std::initializer_list< QVariant > > | table | ) |
Constructs a DsvTable with a copy of each row in the initializer list list.
If all rows in the list are not the same size, this constructor will produce an empty table.
|
static |
Parses dsv as a delimiter-separated values table, using delim as the delimiter and esc as the quote/escape character, and creates a DsvTable from it.
If parsing fails, the returned table will be empty and the optional error variable will contain further details about the error.
QByteArray Qx::DsvTable::toDsv | ( | QChar | delim = ',', |
QChar | esc = '"' ) |
Converts the DsvTable to a serialized delimiter-separated values byte array, using delim as the delimiter and esc as the quote/escape character.