LibEngsas
espreadsheetprovidercsv.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 
21 #ifndef ESPREADSHEETPROVIDERCSV_H
22 #define ESPREADSHEETPROVIDERCSV_H
23 
24 #include <espreadsheetprovider.h>
25 
26 class ESpreadsheetCsv;
27 
28 #include <QDir>
29 #if QT_VERSION >= 0x050000
30 #include <QtPlugin>
31 #endif
32 
33 class QTextCodec;
34 
42 {
43  Q_OBJECT
44  Q_INTERFACES ( ESpreadsheetProvider )
45 #if QT_VERSION >= 0x050000
46  Q_PLUGIN_METADATA(IID LibEngsasESpreadsheetProviderIID FILE "espreadsheetprovidercsv.json")
47 #endif
48  Q_PROPERTY(QString name READ name)
49  Q_PROPERTY(QString description READ description)
50  public:
51  ESpreadsheetProviderCsv(QObject *parent = NULL);
52 
53  QString name() const;
54  QString description() const;
55  QString providerId() const;
56  static QString staticProviderId();
58 
59  QStringList filters() const;
60  bool sheetsSupported() const;
61  bool create(QFile *file);
62  bool load(QFile *file);
63  bool writeData();
64  void close();
65  ESpreadsheet* appendSpreadsheet(QString name);
66  EngSaS::Spreadsheets spreadsheets();
67 
68  private:
72  bool loadSettings();
73  void setSpreadsheet(ESpreadsheetCsv *sheet);
74 
75  QFile *file;
78  QTextCodec* encoding;
79 };
80 
81 #endif // ESPREADSHEETPROVIDERCSV_H