labplot  2.8.2
About: LabPlot is an application for plotting and analysis of 2D and 3D functions and data. It is a complete rewrite of LabPlot1 and lacks in the first release a lot of features available in the predecessor. On the other hand, the GUI and the usability is more superior.
  Fossies Dox: labplot-2.8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

AsciiFilterPrivate.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : AsciiFilterPrivate.h
3  Project : LabPlot
4  Description : Private implementation class for AsciiFilter.
5  --------------------------------------------------------------------
6  Copyright : (C) 2009-2020 Alexander Semke (alexander.semke@web.de)
7  Copyright : (C) 2017 Stefan Gerlach (stefan.gerlach@uni.kn)
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 
30 #ifndef ASCIIFILTERPRIVATE_H
31 #define ASCIIFILTERPRIVATE_H
32 
33 class KFilterDev;
34 class AbstractDataSource;
35 class AbstractColumn;
36 class AbstractAspect;
37 class Spreadsheet;
38 class MQTTTopic;
39 
41 
42 public:
44 
45  int isPrepared();
46  QString separator() const;
47 
48  //preview
49  QVector<QStringList> preview(const QString& fileName, int lines);
50  QVector<QStringList> preview(QIODevice&);
51 
52  //read
53  void readDataFromDevice(QIODevice&, AbstractDataSource* = nullptr,
57  qint64 readFromLiveDevice(QIODevice&, AbstractDataSource*, qint64 from = -1);
58  void readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr,
60 
61  //write
62  void write(const QString& fileName, AbstractDataSource*);
63 
64  //helpers
65  int prepareDeviceToRead(QIODevice&);
67  QString previewValue(const QString&, AbstractColumn::ColumnMode);
68  void setValue(int col, int row, const QString& value);
69  QStringList getLineString(QIODevice&);
70 
71 #ifdef HAVE_MQTT
72  int prepareToRead(const QString&);
73  QVector<QStringList> preview(const QString& message);
74  AbstractColumn::ColumnMode MQTTColumnMode() const;
75  QString MQTTColumnStatistics(const MQTTTopic*) const;
76  void readMQTTTopic(const QString& message, AbstractDataSource*);
77  void setPreparedForMQTT(bool, MQTTTopic*, const QString&);
78 #endif
79 
80  const AsciiFilter* q;
81 
82  QString commentCharacter{'#'};
83  QString separatingCharacter{QStringLiteral("auto")};
84  QString dateTimeFormat;
85  QLocale::Language numberFormat{QLocale::C};
86  QLocale locale{QLocale::C};
87  bool autoModeEnabled{true};
88  bool headerEnabled{true};
89  bool skipEmptyParts{false};
91  double nanValue{NAN};
92  bool removeQuotesEnabled{false};
93  bool createIndexEnabled{false};
95  QStringList vectorNames;
97  int startRow{1};
98  int endRow{-1};
99  int startColumn{1};
100  int endColumn{-1};
102 
103  //TODO: redesign and remove this later
104  bool readingFile{false};
106 
107 private:
108  static const unsigned int m_dataTypeLines = 10; // maximum lines to read for determining data types
109  QString m_separator;
111  int m_actualRows{0};
112  int m_actualCols{0};
113  int m_prepared{false};
114  int m_columnOffset{0}; // indexes the "start column" in the datasource. Data will be imported starting from this column.
115  std::vector<void*> m_dataContainer; // pointers to the actual data containers
116 
117  QDateTime parseDateTime(const QString& string, const QString& format);
118 };
119 
120 #endif
#define C(a, b)
Definition: Faddeeva.cc:255
Base class of all persistent objects in a Project.
Interface definition for data with column logic.
Interface for the data sources.
qint64 readFromLiveDevice(QIODevice &, AbstractDataSource *, qint64 from=-1)
QString previewValue(const QString &, AbstractColumn::ColumnMode)
QStringList getLineString(QIODevice &)
QLocale::Language numberFormat
void readFromLiveDeviceNotFile(QIODevice &, AbstractDataSource *, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace)
void write(const QString &fileName, AbstractDataSource *)
void readDataFromDevice(QIODevice &, AbstractDataSource *=nullptr, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace, int lines=-1)
void setValue(int col, int row, const QString &value)
QDateTime parseDateTime(const QString &string, const QString &format)
std::vector< void * > m_dataContainer
int prepareDeviceToRead(QIODevice &)
QVector< QStringList > preview(const QString &fileName, int lines)
AsciiFilterPrivate(AsciiFilter *)
static const unsigned int m_dataTypeLines
void initDataContainers(Spreadsheet *)
const AsciiFilter * q
void readDataFromFile(const QString &fileName, AbstractDataSource *=nullptr, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace)
QVector< AbstractColumn::ColumnMode > columnModes
QString separator() const
Returns the separator used by the filter.
Manages the import/export of data organized as columns (vectors) from/to an ASCII-file.
Definition: AsciiFilter.h:42
Represents a topic of a subscription made in MQTTClient.
Definition: MQTTTopic.h:39
Aspect providing a spreadsheet table with column logic.
Definition: Spreadsheet.h:40