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)  

AbstractFileFilter.h
Go to the documentation of this file.
1 /***************************************************************************
2 File : AbstractFileFilter.h
3 Project : LabPlot
4 Description : file I/O-filter related interface
5 --------------------------------------------------------------------
6 Copyright : (C) 2009-2018 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 
29 #ifndef ABSTRACTFILEFILTER_H
30 #define ABSTRACTFILEFILTER_H
31 
33 #include <QObject>
34 #include <QLocale>
35 #include <memory> // smart pointer
36 
37 class AbstractDataSource;
38 class XmlStreamReader;
39 class QXmlStreamWriter;
40 
41 class AbstractFileFilter : public QObject {
42  Q_OBJECT
43  Q_ENUMS(FileType)
44  Q_ENUMS(ImportMode)
45 
46 public:
48  enum class ImportMode {Append, Prepend, Replace};
49 
51  ~AbstractFileFilter() override = default;
52 
53  static bool isNan(const QString&);
54  static AbstractColumn::ColumnMode columnMode(const QString& valueString, const QString& dateTimeFormat, QLocale::Language);
55  static AbstractColumn::ColumnMode columnMode(const QString& valueString, const QString& dateTimeFormat, const QLocale& = QLocale());
56  static QString dateTimeFormat(const QString& valueString);
57  static QStringList numberFormats();
58  static AbstractFileFilter::FileType fileType(const QString&);
59  static QStringList fileTypes();
60 
61  virtual void readDataFromFile(const QString& fileName, AbstractDataSource* = nullptr, ImportMode = ImportMode::Replace) = 0;
62  virtual void write(const QString& fileName, AbstractDataSource*) = 0;
63 
64  virtual void loadFilterSettings(const QString& filterName) = 0;
65  virtual void saveFilterSettings(const QString& filterName) const = 0;
66 
67  virtual void save(QXmlStreamWriter*) const = 0;
68  virtual bool load(XmlStreamReader*) = 0;
69 
70  FileType type() const { return m_type; }
71 
72 signals:
73  void completed(int) const; //!< int ranging from 0 to 100 notifies about the status of a read/write process
74 
75 protected:
77 };
78 
79 #endif
Interface for the data sources.
Interface for the input/output file filters.
static AbstractFileFilter::FileType fileType(const QString &)
virtual void loadFilterSettings(const QString &filterName)=0
virtual void saveFilterSettings(const QString &filterName) const =0
static QString dateTimeFormat(const QString &valueString)
AbstractFileFilter(FileType type)
virtual void write(const QString &fileName, AbstractDataSource *)=0
virtual bool load(XmlStreamReader *)=0
static QStringList fileTypes()
const FileType m_type
static bool isNan(const QString &)
static QStringList numberFormats()
virtual void readDataFromFile(const QString &fileName, AbstractDataSource *=nullptr, ImportMode=ImportMode::Replace)=0
virtual void save(QXmlStreamWriter *) const =0
~AbstractFileFilter() override=default
FileType type() const
static AbstractColumn::ColumnMode columnMode(const QString &valueString, const QString &dateTimeFormat, QLocale::Language)
void completed(int) const
int ranging from 0 to 100 notifies about the status of a read/write process
XML stream parser that supports errors as well as warnings. This class also adds line and column numb...