QGpCoreTools/XMLHeader.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of QGpCoreTools.
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 : 2009-06-08
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef XMLHEADER_H
00029 #define XMLHEADER_H
00030 
00031 #include "XMLClass.h"
00032 #include "Translations.h"
00033 #include "QGpCoreToolsDLLExport.h"
00034 
00035 namespace QGpCoreTools {
00036 
00037 class QGPCORETOOLS_EXPORT XMLHeader : public XMLClass
00038 {
00039   TRANSLATIONS("XMLHeader")
00040 public:
00041   XMLHeader(XMLClass * object);
00042   XMLHeader(const XMLHeader& o);
00043 
00044   virtual const QString& xml_tagName() const;
00045   static const QString xmlHeaderTag;
00046   static const QString xmlHeaderOldTag;
00047 
00048   void addAlternateTag(const QString& t) {_alternateTags.append(t);}
00049 
00050   Error xml_saveFile(QString fileName, XMLContext * context=0, FileType ft=TarFile) const;
00051   QString xml_saveString(bool header=true, XMLContext * context=0) const;
00052   QByteArray xml_saveByteArray(XMLContext * context=0) const;
00053   Error xml_restoreFile(QString fileName, XMLContext * context=0, FileType ft=TarFile);
00054   Error xml_restoreString(QString str, XMLContext * context=0);
00055   Error xml_restoreByteArray(QByteArray data, XMLContext * context=0);
00056 protected:
00057   virtual void xml_writeChildren(XML_WRITECHILDREN_ARGS) const;
00058   virtual void xml_attributes(XML_ATTRIBUTES_ARGS) const;
00059   virtual bool xml_setAttributes(XML_SETATTRIBUTES_ARGS);
00060   virtual XMLMember xml_member(XML_MEMBER_ARGS);
00061   virtual void xml_polishChild(XML_POLISHCHILD_ARGS);
00062   virtual bool xml_polished(XML_POLISHED_ARGS) {return _polished;}
00063 
00064   QString _tag;
00065   XMLClass * _object;
00066   bool _polished;
00067 private:
00068   static void xml_saveDocType(XMLStream& s);
00069   static bool checkDocType(const QChar *& ptr, int& line);
00070 
00071   QStringList _alternateTags;
00072 };
00073 
00074 } // namespace QGpCoreTools
00075 
00076 #endif // XMLHEADER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines