LibEngsas
espreadsheetcsv.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef ESPREADSHEETCSV_H
21 #define ESPREADSHEETCSV_H
22 
23 #include <espreadsheet.h>
24 
25 class QFile;
26 class QTextCodec;
27 
29 {
30  Q_OBJECT
31  public:
32  ESpreadsheetCsv(QString absFilePath, QString separator, QString textmarker, QTextCodec *encoding, ESpreadsheetProvider *provider);
34 
35  bool setData(ESpreadsheetCell cell);
36  ESpreadsheetCell data(int row, int column) const;
37  int rowCount() const;
38  int columnCount() const;
39  bool writeData();
40 
41  private:
42  void loadSheet();
43  QList<QVariant> tokenize(QString line, bool &withinQuotes);
44 
45  QList<QList<QVariant> > myData;
46  QFile *file;
48  QTextCodec *myEncoding;
49 };
50 
51 #endif // ESPREADSHEETCSV_H
QString mySeparator
Definition: espreadsheetcsv.h:47
QFile * file
Definition: espreadsheetcsv.h:46
int rowCount() const
Returns the number of rows within this spreadsheet.
Definition: espreadsheetcsv.cpp:75
A spreadsheet, within a spreadsheet file.A spreadsheet consists of cells of type ESpreadsheetCell,...
Definition: espreadsheet.h:58
ESpreadsheetCsv(QString absFilePath, QString separator, QString textmarker, QTextCodec *encoding, ESpreadsheetProvider *provider)
Definition: espreadsheetcsv.cpp:27
int columnCount() const
Returns the number of columns within this spreadsheet.
Definition: espreadsheetcsv.cpp:82
ESpreadsheetProvider * provider() const
Definition: espreadsheet.cpp:41
QString myTextmarker
Definition: espreadsheetcsv.h:47
QList< QList< QVariant > > myData
Definition: espreadsheetcsv.h:45
bool setData(ESpreadsheetCell cell)
Adds value to this spreadsheet at ESpreadsheetCell::row() and ESpreadsheetCell::column of cell.
Definition: espreadsheetcsv.cpp:43
ESpreadsheetCell data(int row, int column) const
Returns the data of the cell row, column.
Definition: espreadsheetcsv.cpp:63
void loadSheet()
Definition: espreadsheetcsv.cpp:121
Definition: espreadsheetcsv.h:28
~ESpreadsheetCsv()
Definition: espreadsheetcsv.cpp:37
bool writeData()
Definition: espreadsheetcsv.cpp:95
Represents one cell of a ESpreadsheetIt contains the value (see value()) of a cell and also the forma...
Definition: espreadsheetcell.h:40
QTextCodec * myEncoding
Definition: espreadsheetcsv.h:48
QList< QVariant > tokenize(QString line, bool &withinQuotes)
Definition: espreadsheetcsv.cpp:150
Interface to implement spreadsheet providers (e. g. to create excel files or ods, ....
Definition: espreadsheetprovider.h:38