CSVDataBase Class Reference
A class that allows reading of csv files. More...
#include <csvdatabase.h>
Inherits QFile.
Inheritance diagram for CSVDataBase:
Public Methods | |
CSVDataBase (const char *file=0) | |
~CSVDataBase () | |
QString | readItem (int column, int line) |
QString | readItem (const char *identifier, int line) |
int | columnCount () |
Protected Methods | |
int | readItems (const char *linestr, QStrList *strlist) |
int | readDefinitionLine () |
int | readCurrentLine (int line) |
QString | readLine (int line) |
QString | readNextLine () |
QString | readItem (int column, const char *linestr) |
QString | readItem (const char *identifier) |
Detailed Description
A class that allows reading of csv files.This class allows access to the elements of a comma-separated-value (csv) file. It doesn't store the entire array in memory, but reads and processes the elements line-by-line. The first line of the csv file must be a header line which consists of ID strings defining the contents of the columns.
Definition at line 30 of file csvdatabase.h.
Constructor & Destructor Documentation
|
The constructor. Initializes the access to a csv file.
Definition at line 19 of file csvdatabase.cpp. References QFile::setName(). |
|
The destructor.
Definition at line 30 of file csvdatabase.cpp. |
Member Function Documentation
|
Reads an element from the csv file. The element is read from column column and line line.
Definition at line 71 of file csvdatabase.cpp. References readCurrentLine(). Referenced by CompletedWUList::addLoggedWU(), CompletedWUList::fillTotalList(), CompletedWUList::fillWUList(), and readItem(). |
|
Reads an element from the csv file. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The element is read from the column specified by identifier and line line.
Definition at line 82 of file csvdatabase.cpp. References QString::isEmpty(), readCurrentLine(), readDefinitionLine(), and readItem(). |
|
Returns the number of columns in the csv file.
Definition at line 183 of file csvdatabase.cpp. References QString::isEmpty(), and readDefinitionLine(). Referenced by SetiLoc::logWorkUnit(). |
|
Reads all elements of a line. Reads all elements of the line linestr and stores them in the string list strlist.
Definition at line 35 of file csvdatabase.cpp. Referenced by readCurrentLine(), and readDefinitionLine(). |
|
Reads the definition line. The definition (or header) line must always be the first line of a csv file.
Definition at line 154 of file csvdatabase.cpp. References readItems(), and QIODevice::readLine(). Referenced by columnCount(), and readItem(). |
|
Reads the current line. line becomes the current line.
Definition at line 165 of file csvdatabase.cpp. References readItems(), QIODevice::readLine(), and readNextLine(). Referenced by readItem(). |
|
Reads a line and returns it in a string.
Definition at line 118 of file csvdatabase.cpp. References QFile::at(), QTextStream::atEnd(), QIODevice::isOpen(), QIODevice::isReadable(), and QTextStream::readLine(). |
|
Reads a line at the current file index and returns it in a string.
Definition at line 140 of file csvdatabase.cpp. References QTextStream::atEnd(), QIODevice::isOpen(), QIODevice::isReadable(), and QTextStream::readLine(). Referenced by readCurrentLine(). |
|
Extracts an element from a string. The element at column column is read from the string linestr.
|
|
Extracts an element from a string. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The element is read from the column specified by identifier in the current line.
Definition at line 92 of file csvdatabase.cpp. References QString::isEmpty(). |
The documentation for this class was generated from the following files: