SciDAVis  1.D4
Double2DateTimeFilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : Double2DateTimeFilter.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2007 by Knut Franke, Tilman Benkert
6  Email (use @ for *) : knut.franke*gmx.de, thzs@gmx.net
7  Description : Conversion filter double -> QDateTime
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 DOUBLE2DATE_TIME_FILTER_H
29 #define DOUBLE2DATE_TIME_FILTER_H
30 
31 #include "../AbstractSimpleFilter.h"
32 #include <QDateTime>
33 #include <QDate>
34 #include <QTime>
35 #include "lib/XmlStreamReader.h"
36 #include <QXmlStreamWriter>
37 
46 {
47  Q_OBJECT
48 
49  public:
51 
53  Double2DateTimeFilter(UnitInterval unit, QDateTime date_time_0) :
54  m_unit_interval(unit),
55  m_date_time_0(date_time_0) {};
56 
57  virtual QDate dateAt(int row) const {
58  return dateTimeAt(row).date();
59  }
60  virtual QTime timeAt(int row) const {
61  return dateTimeAt(row).time();
62  }
63  virtual QDateTime dateTimeAt(int row) const;
64 
67 
68  protected:
70  virtual bool inputAcceptable(int, const AbstractColumn *source) {
71  return source->dataType() == SciDAVis::TypeDouble;
72  }
73 
74  private:
76  QDateTime m_date_time_0;
77 };
78 
79 #endif // ifndef DOUBLE2DATE_TIME_FILTER_H
80