SpectraPac 2.0(r200)
Evaluates PAC Measurements

PacAbstractContainer.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008-2010 by Matthias Nagl                              *
00003  *   mnagl@uni-goettingen.de                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef PACABSTRACTCONTAINER_H
00022 #define PACABSTRACTCONTAINER_H
00023 
00024 #include <QWidget>
00025 #include <QCoreApplication>
00026 #include <QTextStream>
00027 #include <QPointer>
00028 
00029 class PacBasicMeasurementInfo;
00030 class QTabWidget;
00031 class QDomElement;
00032 
00040 class PacAbstractContainer : public QObject
00041 {
00042     Q_OBJECT
00043 public:
00044   PacAbstractContainer(
00045       const QString &primarySpectrumsName,
00046       const QString &xmlNodeName,
00047       const PacBasicMeasurementInfo *basicinfo,
00048       QObject *parent = 0
00049                         );
00050   virtual ~PacAbstractContainer();
00051 
00055   virtual bool isValid() const;
00056 
00060   virtual void appendWidgets(QTabWidget *tabwidget, QWidget * filetoolbox) = 0;
00066   virtual void appendToDom(QDomElement &root) const;
00072   virtual void initializeFromDom(const QDomElement &root);
00073 
00074   QString csvMainHeader(const QString &spectrumname, const QString &filename);
00075 
00080   static QString toXmlText(double value);
00081   static QString toXmlText(float value);
00082   static QString toXmlText(quint32 value);
00083   static QString toXmlText(qint32 value);
00084   static QString toXmlText(quint64 value);
00085   static QString toXmlText(qint64 value);
00087 
00088   static QString toXmlText(const QVector<qreal> &array);
00089   static QVector<qreal> xmlTextToDoubleArray(const QString &txt);
00090   static QString toXmlText(const QVector<quint64> &array);
00091   static QVector<quint64> xmlTextToUInt64Array(const QString &txt);
00092 
00093 public slots:
00094   void exportAsCSV();
00095 
00096 protected:
00097   virtual void csvInputHeaderAndData(QTextStream &s) const = 0;
00098   virtual void saveDataInDom(QDomElement &top) const = 0;
00099   virtual void loadDataFromDom(const QDomElement &top) = 0;
00100 //  void appendSimpleElement(QDomElement *parent, const QString &name, const QString &content) const;
00101 
00102   const PacBasicMeasurementInfo *basicinfo;
00103   QPointer<QWidget> w;
00104   QString primarySpectrumsName;
00105   const QString xmlnodename;
00106   bool valid;
00107 };
00108 
00109 #endif // PACABSTRACTCONTAINER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines