GeopsyCore/AbstractFileFormat.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of GeopsyCore.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created: 2010-07-15
00022 **  Authors:
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef ABSTRACTFILEFORMAT_H
00028 #define ABSTRACTFILEFORMAT_H
00029 
00030 #include <QGpCoreTools.h>
00031 
00032 #include "SignalFileFormat.h"
00033 #include "GeopsyCoreDLLExport.h"
00034 
00035 namespace GeopsyCore {
00036 
00037   class SignalFile;
00038   class Signal;
00039   class SubSignalPool;
00040 
00041   class GEOPSYCORE_EXPORT AbstractFileFormat: public XMLClass, public SharedObject
00042   {
00043     TRANSLATIONS("AbstractSignalFormat");
00044   public:
00045     AbstractFileFormat();
00046     AbstractFileFormat(const AbstractFileFormat& o);
00047     ~AbstractFileFormat();
00048 
00049     void operator=(const AbstractFileFormat& o);
00050 
00051     void setName(const QString& n) {_name=n;}
00052     const QString& name() const {return _name;}
00053     QString toString() const;
00054 
00055     void clearExtensions() {_extensions.clear();}
00056     void addExtension(QString e);
00057     void addExtensions(const QString& el);
00058     const QStringList& extensions() const {return _extensions;}
00059     QString extensionFilter() const;
00060 
00061     virtual SignalFileFormat::Format format() const {return SignalFileFormat::Custom;}
00062     virtual int complexity() const {return 0;}
00063     virtual bool isValid(const QString& /* fileName */) const {return false;}
00064     virtual bool isReadOnly() const {return true;}
00065     virtual SignalFileFormat::Storage storage() const {return SignalFileFormat::Multi;}
00066 
00067     virtual bool load(SignalFile * file) const;
00068     virtual bool load(const Signal * sig, double * samples) const;
00069     virtual bool save(const SubSignalPool& subpool, const QString& filePath) const;
00070   protected:
00071     virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00072     virtual XMLMember xml_member(XML_MEMBER_ARGS);
00073     virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00074   private:
00075     QString _name;
00076     QStringList _extensions;
00077   };
00078 
00079 } // namespace GeopsyCore
00080 
00081 #endif // ABSTRACTFILEFORMAT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines