|
bool | loadFile (const QString &fileName) |
| load fileName . load the complete file at once. More...
|
|
bool | loadFromString (const QString &content) |
| load content from a given string. More...
|
|
QString | columnName (const int col) |
| get caption of ith column. More...
|
|
int | columnIndex (const QString &columnName) const |
| index of column or -1 if not available More...
|
|
QVariant | value (const int row, const QString column_name) const |
|
QVariant | value (const int row, const int col) const |
| get value of cell denoted by row and cell . Not available in streaming mode. More...
|
|
QVariant | row (const int row) |
| retrieve content of the full row row as a QJSValue More...
|
|
QJSValue | jsValue (const int row, const int col) const |
|
QJSValue | jsValue (const int row, const QString column_name) const |
|
void | setValue (const int row, const int col, QVariant value) |
| set the value of the column More...
|
|
void | saveFile (const QString &fileName) |
| save the current content to a file More...
|
|
|
| CSVFile (QObject *parent=0) |
|
| CSVFile (const QString &fileName) |
| ctor, load fileName . More...
|
|
bool | openFile (const QString &fileName) |
| open file in streaming mode. More...
|
|
QVariant | colValue (const int col) |
| get value of column with index col . Use in streaming mode. More...
|
|
bool | next () |
| advance to next record (i.e. line). return false if end of file is reached. More...
|
|
bool | streamingMode () const |
| return true, if in "streaming mode" (for large files) More...
|
|
bool | hasCaptions () const |
| true, if first line contains headers More...
|
|
bool | flat () const |
| simple list, not multiple columns More...
|
|
int | rowCount () const |
| number or rows (excl. captions), or -1. More...
|
|
int | colCount () const |
| number of columns, or -1 More...
|
|
bool | isEmpty () const |
|
QStringList | captions () const |
| returns true when no valid file has been loaded (returns false when a file with 0 rows is loaded) More...
|
|
QStringList | column (const int col) const |
| retrieve a string list of a given row More...
|
|
QVariantList | values (const int row) const |
| get a list of the values in row "row" More...
|
|
void | setHasCaptions (const bool hasCaps) |
|
void | setFixedWidth (const bool hasFixedWidth) |
|
void | setFlat (const bool isflat) |
|
Provides access to table data stored in text files (CSV style).
Tables have optionally headers in first line (hasCaptions()) and can use various delimiters ("tab",";",","," "). If separated by spaces, consecuteive spaces are merged. Table dimensions can be accessed with colCount() and rowCount(), cell values as QVariant are retrieved by value(). full rows are retrieved using row(). Files are loaded by loadFile() or by passing a filename to the constructor:
for (int col=0; col<file.colCount(); col++)
Provides access to table data stored in text files (CSV style).
Definition: csvfile.h:27
QVariant row(const int row)
retrieve content of the full row row as a QJSValue
Definition: csvfile.cpp:253
QVariant value(const int row, const QString column_name) const
Definition: csvfile.h:61
Planned is also a "streaming" mode for large files (loadFile(), while(file.next()) file.value(x) ), but not finsihed yet.