SciDAVis  1.D4
AbstractImportFilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : AbstractImportFilter.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2008-2009 Knut Franke
6  Email (use @ for *) : Knut.Franke*gmx.net
7  Description : Interface for import operations.
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 ABSTRACT_IMPORT_FILTER_H
31 #define ABSTRACT_IMPORT_FILTER_H
32 
33 #include <QObject>
34 #include <QStringList>
35 
36 class AbstractAspect;
37 class QIODevice;
38 
39 // This works just like attr_reader in Ruby (except that you also have to declare the member
40 // variable), i.e. it declares a get method for a (private) member variable.
41 #define READER(type, name) \
42  type name() const { return d_ ## name; }
43 
44 // This works just like attr_accessor in Ruby (except that you also have to declare the member
45 // variable), i.e. it declares get and set methods for a (private) member variable.
46 // TODO: find a better home for this macro as well as READER
47 // TODO: Due to technical limitations, this violates the method naming conventions in
48 // doc/coding.dox. Maybe we should add a special rule for accessor methods. Unless someone knows how
49 // to let the preprocessor do case conversion.
50 #define ACCESSOR(type, name) \
51  type name() const { return d_ ## name; }; \
52  void set_ ## name(const type value) { d_ ## name = value; }
53 
55 
76 class AbstractImportFilter : public QObject
77 {
78  Q_OBJECT
79 
80  public:
81  virtual ~AbstractImportFilter() {}
83 
86  virtual AbstractAspect * importAspect(QIODevice * input) = 0;
88  virtual QStringList fileExtensions() const = 0;
90  virtual QString name() const = 0;
92  QString nameAndPatterns() const {
93  return name() + " (*." + fileExtensions().join(" *.") + ")";
94  }
95 };
96 
97 #endif // ifndef ABSTRACT_IMPORT_FILTER_H
98 
99