SciDAVis  1.D4
AsciiTableImportFilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : AsciiTableImportFilter.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2008-2009 Knut Franke
6  Email (use @ for *) : Knut.Franke*gmx.net
7  Description : Import an ASCII file as Table.
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 ASCII_TABLE_IMPORT_FILTER_H
31 #define ASCII_TABLE_IMPORT_FILTER_H
32 
34 #include <QLocale>
35 
37 
52 {
53  Q_OBJECT
54 
55  public:
57  d_ignored_lines(0),
58  d_separator("\t"),
60  d_trim_whitespace(false),
61  d_simplify_whitespace(false),
62  d_convert_to_numeric(false),
63  d_numeric_locale(QLocale::c())
64  {}
65  virtual AbstractAspect * importAspect(QIODevice * input);
66  virtual QStringList fileExtensions() const;
67  virtual QString name() const { return QObject::tr("ASCII table"); }
68 
69  ACCESSOR(int, ignored_lines);
70  Q_PROPERTY(int ignored_lines READ ignored_lines WRITE set_ignored_lines);
71 
72  QString separator() const { QString result = d_separator; return result.replace("\t", "\\t"); }
73  void set_separator(const QString &value) { d_separator = value; d_separator.replace("\\t","\t"); }
74  Q_PROPERTY(QString separator READ separator WRITE set_separator);
75 
77  Q_PROPERTY(bool first_row_names_columns READ first_row_names_columns WRITE set_first_row_names_columns);
78 
80  Q_PROPERTY(bool trim_whitespace READ trim_whitespace WRITE set_trim_whitespace);
81 
83  Q_PROPERTY(bool simplify_whitespace READ simplify_whitespace WRITE set_simplify_whitespace);
84 
86  Q_PROPERTY(bool convert_to_numeric READ convert_to_numeric WRITE set_convert_to_numeric);
87 
88  ACCESSOR(QLocale, numeric_locale);
89  Q_PROPERTY(QLocale numeric_locale READ numeric_locale WRITE set_numeric_locale);
90 
91  private:
92  int d_ignored_lines;
93  QString d_separator;
99 };
100 
101 #endif // ifndef ASCII_TABLE_IMPORT_FILTER_H