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)  

AsciiFilter.h
Go to the documentation of this file.
1 /***************************************************************************
2 File : AsciiFilter.h
3 Project : LabPlot
4 Description : ASCII I/O-filter
5 --------------------------------------------------------------------
6 Copyright : (C) 2009-2019 Alexander Semke (alexander.semke@web.de)
7 Copyright : (C) 2017 Stefan Gerlach (stefan.gerlach@uni.kn)
8 ***************************************************************************/
9 
10 /***************************************************************************
11 * *
12 * This program is free software; you can redistribute it and/or modify *
13 * it under the terms of the GNU General Public License as published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 * This program is distributed in the hope that it will be useful, *
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20 * GNU General Public License for more details. *
21 * *
22 * You should have received a copy of the GNU General Public License *
23 * along with this program; if not, write to the Free Software *
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25 * Boston, MA 02110-1301 USA *
26 * *
27 ***************************************************************************/
28 #ifndef ASCIIFILTER_H
29 #define ASCIIFILTER_H
30 
33 
34 class Spreadsheet;
35 class QStringList;
36 class QIODevice;
37 class AsciiFilterPrivate;
38 class QAbstractSocket;
39 class MQTTTopic;
40 class MQTTClient;
41 
43  Q_OBJECT
44 
45 public:
46  AsciiFilter();
47  ~AsciiFilter() override;
48 
49  static QStringList separatorCharacters();
50  static QStringList commentCharacters();
51  static QStringList dataTypes();
52  static QStringList predefinedFilters();
53 
54  static QString fileInfoString(const QString&);
55  static int columnNumber(const QString& fileName, const QString& separator = QString());
56  static size_t lineNumber(const QString& fileName);
57  size_t lineNumber(QIODevice&) const; // calculate number of lines if device supports it
58 
59  // read data from any device
60  void readDataFromDevice(QIODevice& device, AbstractDataSource*,
62  void readFromLiveDeviceNotFile(QIODevice& device, AbstractDataSource*dataSource);
63  qint64 readFromLiveDevice(QIODevice& device, AbstractDataSource*, qint64 from = -1);
64  // overloaded function to read from file
65  void readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr,
67  void write(const QString& fileName, AbstractDataSource*) override;
68 
69  QVector<QStringList> preview(const QString& fileName, int lines);
70  QVector<QStringList> preview(QIODevice& device);
71 
72  void loadFilterSettings(const QString&) override;
73  void saveFilterSettings(const QString&) const override;
74 
75 #ifdef HAVE_MQTT
76  QVector<QStringList> preview(const QString& message);
77  void readMQTTTopic(const QString& message, AbstractDataSource*);
78  void setPreparedForMQTT(bool, MQTTTopic*, const QString&);
79 #endif
80 
81  QString separator() const;
82  void setCommentCharacter(const QString&);
83  QString commentCharacter() const;
84  void setSeparatingCharacter(const QString&);
85  QString separatingCharacter() const;
86  void setDateTimeFormat(const QString&);
87  QString dateTimeFormat() const;
88  void setNumberFormat(QLocale::Language);
89  QLocale::Language numberFormat() const;
90 
91  void setAutoModeEnabled(const bool);
92  bool isAutoModeEnabled() const;
93  void setHeaderEnabled(const bool);
94  bool isHeaderEnabled() const;
95  void setSkipEmptyParts(const bool);
96  bool skipEmptyParts() const;
97  void setSimplifyWhitespacesEnabled(const bool);
98  bool simplifyWhitespacesEnabled() const;
99  void setNaNValueToZero(const bool);
100  bool NaNValueToZeroEnabled() const;
101  void setRemoveQuotesEnabled(const bool);
102  bool removeQuotesEnabled() const;
103  void setCreateIndexEnabled(const bool);
104  bool createIndexEnabled() const;
105  void setCreateTimestampEnabled(const bool);
106  bool createTimestampEnabled() const;
107 
108  void setVectorNames(const QString&);
109  void setVectorNames(const QStringList&);
110  QStringList vectorNames() const;
112 
113  void setStartRow(const int);
114  int startRow() const;
115  void setEndRow(const int);
116  int endRow() const;
117  void setStartColumn(const int);
118  int startColumn() const;
119  void setEndColumn(const int);
120  int endColumn() const;
121 
122  void save(QXmlStreamWriter*) const override;
123  bool load(XmlStreamReader*) override;
124 
125  int isPrepared();
126 
127 private:
128  std::unique_ptr<AsciiFilterPrivate> const d;
129  friend class AsciiFilterPrivate;
130 };
131 
132 #endif
Interface for the data sources.
Interface for the input/output file filters.
Manages the import/export of data organized as columns (vectors) from/to an ASCII-file.
Definition: AsciiFilter.h:42
void setCommentCharacter(const QString &)
bool isHeaderEnabled() const
static QString fileInfoString(const QString &)
QVector< QStringList > preview(const QString &fileName, int lines)
void setEndColumn(const int)
void setHeaderEnabled(const bool)
QStringList vectorNames() const
void readDataFromFile(const QString &fileName, AbstractDataSource *=nullptr, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace) override
bool skipEmptyParts() const
void setVectorNames(const QString &)
void setRemoveQuotesEnabled(const bool)
bool createIndexEnabled() const
int endColumn() const
void save(QXmlStreamWriter *) const override
QLocale::Language numberFormat() const
void setStartRow(const int)
static QStringList dataTypes()
QString separator() const
qint64 readFromLiveDevice(QIODevice &device, AbstractDataSource *, qint64 from=-1)
Definition: AsciiFilter.cpp:76
int isPrepared()
void setSkipEmptyParts(const bool)
void setStartColumn(const int)
void write(const QString &fileName, AbstractDataSource *) override
bool simplifyWhitespacesEnabled() const
void setSeparatingCharacter(const QString &)
~AsciiFilter() override
static size_t lineNumber(const QString &fileName)
static int columnNumber(const QString &fileName, const QString &separator=QString())
bool removeQuotesEnabled() const
void saveFilterSettings(const QString &) const override
static QStringList commentCharacters()
bool load(XmlStreamReader *) override
static QStringList separatorCharacters()
QString commentCharacter() const
static QStringList predefinedFilters()
bool isAutoModeEnabled() const
void setEndRow(const int)
void setNumberFormat(QLocale::Language)
void readFromLiveDeviceNotFile(QIODevice &device, AbstractDataSource *dataSource)
Definition: AsciiFilter.cpp:72
int startRow() const
int startColumn() const
void setAutoModeEnabled(const bool)
void loadFilterSettings(const QString &) override
QString separatingCharacter() const
QVector< AbstractColumn::ColumnMode > columnModes()
void setCreateIndexEnabled(const bool)
bool createTimestampEnabled() const
void setSimplifyWhitespacesEnabled(const bool)
void setCreateTimestampEnabled(const bool)
void setNaNValueToZero(const bool)
QString dateTimeFormat() const
void setDateTimeFormat(const QString &)
std::unique_ptr< AsciiFilterPrivate > const d
Definition: AsciiFilter.h:128
bool NaNValueToZeroEnabled() const
void readDataFromDevice(QIODevice &device, AbstractDataSource *, AbstractFileFilter::ImportMode=AbstractFileFilter::ImportMode::Replace, int lines=-1)
Definition: AsciiFilter.cpp:68
int endRow() const
The MQTT Client connects to the broker set in ImportFileWidget. It manages the MQTTSubscriptions,...
Definition: MQTTClient.h:48
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
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...