GCoreXmlSerializer.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 - 2006 by Raphael Langerhorst                      *
00003  *   raphael-langerhorst@gmx.at                                            *
00004  *                                                                         *
00005  *   Permission is hereby granted, free of charge, to any person obtaining *
00006  *   a copy of this software and associated documentation files (the       *
00007  *   "Software"), to deal in the Software without restriction, including   *
00008  *   without limitation the rights to use, copy, modify, merge, publish,   *
00009  *   distribute, sublicense, and/or sell copies of the Software, and to    *
00010  *   permit persons to whom the Software is furnished to do so, subject to *
00011  *   the following conditions:                                             *
00012  *                                                                         *
00013  *   The above copyright notice and this permission notice shall be        *
00014  *   included in all copies or substantial portions of the Software.       *
00015  *                                                                         *
00016  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
00017  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
00018  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
00019  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
00020  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
00021  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
00022  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
00023  ***************************************************************************/
00024 
00025 #ifndef GCOREXMLSERIALIZER_H
00026 #define GCOREXMLSERIALIZER_H
00027 
00028 #include <GElement.h>
00029 #include <GElementID.h>
00030 #include <GEnergy.h>
00031 #include <GForm.h>
00032 #include <GAgent.h>
00033 #include <GObject.h>
00034 #include <GMatrix44.h>
00035 #include <GElementInfluence.h>
00036 #include <GElementData.h>
00037 
00038 #include <qobject.h>
00039 #include <qstring.h>
00040 #include <qdom.h>
00041 #include <QList>
00042 
00043 namespace GCS
00044 {
00045   class GWorldData;
00046 }
00047 
00048 
00049 namespace GWE
00050 {
00051 
00082 class GCoreXmlSerializer : public QObject
00083 {
00084   Q_OBJECT
00085   
00086   protected:
00087   
00093     const GCS::GWorldData* WorldData;
00094        
00095   public:
00096   
00100     GCoreXmlSerializer(const GCS::GWorldData* world_data, QObject *parent = 0);
00101     
00105     virtual ~GCoreXmlSerializer();
00106     
00110     GCS::GAgent* createAgent(QDomElement data);
00111     
00115     QList<GCS::GAgent*> createAgents(QDomElement data);
00116     
00120     GCS::GElementData* createElementData(QDomElement data);
00121     
00127     GCS::GElement* createElement(QDomElement data);
00128     
00132     GCS::GElementID createElementID(QDomElement data, bool* ok = NULL);
00133     
00137     GCS::GEnergy* createEnergy(QDomElement data);
00138     
00142     GCS::GVector3 createVector3(QDomElement data, bool* ok = NULL);
00143     
00147     GCS::GObject* createObject(QDomElement data);
00148     
00152     GCS::GForm* createForm(QDomElement data);
00153     
00154     GCS::GMatrix44 createMatrix44(QDomElement data, bool* ok = NULL);
00155     
00156     GCS::GElementInfluence createElementInfluence(QDomElement data, bool* ok = NULL);
00157     
00158     GCS::GElementID getInfluenceTarget(QDomElement data, bool* ok = NULL);
00159 
00163     QDomElement serializeAgent(const GCS::GAgent* agent, QString TagName, QDomDocument* document = new QDomDocument());
00164                
00168     QDomElement serializeElementData(const GCS::GElementData* data, QString TagName, QDomDocument* document = new QDomDocument());
00169     
00175     QDomElement serializeElement(const GCS::GElement* element, QString TagName, QDomDocument* document = new QDomDocument());
00176     
00180     QDomElement serializeElementID(const GCS::GElementID& element_id, QString TagName, QDomDocument* document = new QDomDocument());
00181     
00185     QDomElement serializeEnergy(const GCS::GEnergy* energy, QString TagName, QDomDocument* document = new QDomDocument());
00186     
00190     QDomElement serializeForm(const GCS::GForm* form, QString TagName, QDomDocument* document = new QDomDocument());
00191     
00195     QDomElement serializeVector3(const GCS::GVector3* vector3, QString TagName, QDomDocument* document = new QDomDocument());
00196     
00200      QDomElement serializeObject(const GCS::GObject* object, QString TagName, QDomDocument* document = new QDomDocument());
00201 
00202     QDomElement serializeAgents(QList<const GCS::GAgent*> Agents, QString TagName, QDomDocument* document = new QDomDocument());
00203     
00204     QDomElement serializeMatrix44(const GCS::GMatrix44& matrix, QString TagName, QDomDocument* document = new QDomDocument());
00205     
00206     QDomElement serializeElementInfluence(const GCS::GElementInfluence& influence, const GCS::GElementID& target_element, QString TagName, QDomDocument* document = new QDomDocument());
00207 };
00208 
00209 }
00210 
00211 #endif //GCOREXMLSERIALIZER_H

Generated on Thu Nov 16 07:49:12 2006 for G System by  doxygen 1.4.7