00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "omgserialisable.h"
00019 #include <QFile>
00020 #include <QString>
00021 #include <QTextStream>
00022
00023 OmgSerialisable::OmgSerialisable()
00024 {
00025 }
00026 OmgSerialisable::~OmgSerialisable()
00027 {
00028 }
00029 bool OmgSerialisable::toXml(QString theFileName) const
00030 {
00031 bool myResult = false;
00032 QFile myFile( theFileName );
00033 if ( myFile.open( QIODevice::WriteOnly ) )
00034 {
00035 QTextStream myQTextStream( &myFile );
00036 myQTextStream << this->toXml();
00037 myFile.close();
00038 myResult=true;
00039 }
00040 else
00041 {
00042
00043 myResult=false;
00044 }
00045 return myResult ;
00046
00047 }
00048
00049 bool OmgSerialisable::fromXmlFile(QString theFileName)
00050 {
00051 bool myResult = false;
00052 QFile myFile( theFileName );
00053 if ( myFile.open( QIODevice::ReadOnly ) )
00054 {
00055 myResult=this->fromXml(myFile.readAll());
00056 myFile.close();
00057 }
00058 else
00059 {
00060 qDebug("Failed to open " + theFileName.toLocal8Bit() +
00061 " for deserialisation ");
00062
00063 myResult=false;
00064 }
00065 return myResult ;
00066 }
00067