SciFigs/XMLSciFigs.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
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 : 2006-07-04
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef XMLSCIFIGS_H
00029 #define XMLSCIFIGS_H
00030 
00031 #include <QGpCoreTools.h>
00032 
00033 #include "SciFigsDLLExport.h"
00034 
00035 namespace SciFigs {
00036 
00037 class SCIFIGS_EXPORT XMLSciFigs : public XMLClass, public XMLContext
00038 {
00039   TRANSLATIONS( "XMLSciFigs" )
00040 public:
00041   XMLSciFigs();
00042 
00043   virtual const QString& xml_tagName() const {return xmlSciFigsTag;}
00044   static const QString xmlSciFigsTag;
00045 
00046   enum FileType{None=0, MakeUp=1, Data=2, PageHeader=4, Layer=3, Page=7, Selection=8};
00047   Q_DECLARE_FLAGS(FileTypes, FileType)
00048 
00049   XMLClass::Error saveFile(QString fileName, const XMLClass * object, FileTypes type);
00050   QString saveString(const XMLClass * object, FileTypes type);
00051   QByteArray saveByteArray(const XMLClass * object, FileTypes type);
00052   XMLClass::Error restoreFile(QString fileName, XMLClass * object, FileTypes type);
00053   XMLClass::Error restoreString(QString s, XMLClass * object, FileTypes type);
00054   XMLClass::Error restoreByteArray(QByteArray data, XMLClass * object, FileTypes type);
00055   bool restoring() {return _currentFile!=None;}
00056   bool data() {return _currentFile & Data;}
00057   bool makeUp() {return _currentFile & MakeUp;}
00058   bool selection() {return _currentFile & Selection;}
00059   QString currentFileVersion() {return _currentFileVersion;}
00060 protected:
00061   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const;
00062   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00063   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS);
00064   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00065 private:
00066   FileTypes _currentFile;
00067   QString _currentFileVersion;
00068   const XMLClass * _currentObject;
00069 };
00070 
00071 } // namespace SciFigs
00072 
00073 Q_DECLARE_OPERATORS_FOR_FLAGS(SciFigs::XMLSciFigs::FileTypes)
00074 
00075 #endif // XMLSCIFIGS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines