00001 /*************************************************************************** 00002 qsserializable.h 00003 ------------------- 00004 begin : Mon Oct 15 2001 00005 copyright : (C) 2001 by kamil 00006 email : kamil@localhost.localdomain 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QSSERIALIZABLE_H 00019 #define QSSERIALIZABLE_H 00020 00021 #include<qdatastream.h> 00022 00023 class QObject; 00024 class QSSerializable; 00029 class QSObjectFactory 00030 { 00031 public: 00032 enum Flags { 00033 CopyAllData = 1<<0 00034 }; 00038 QSObjectFactory(); 00042 virtual ~QSObjectFactory(); 00047 virtual QSSerializable *loadObjectFromStream( QDataStream& stream, QObject *parent=NULL ) = 0; 00052 virtual void saveObjectToStream( QSSerializable *object, QDataStream& stream ) = 0; 00056 void setFlags( int flags ); 00060 int flags() const { return m_flags; } 00061 00062 protected: 00063 int m_flags; 00064 }; 00065 00066 //---------------------------------------------------------------------------------------------------// 00067 00072 class QSSerializable 00073 { 00074 public: 00078 QSSerializable(); 00082 virtual ~QSSerializable(); 00086 virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory ); 00090 virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory ); 00091 }; 00092 00093 #endif