Abstraction and serialization for entities
This commit is contained in:
parent
5cb96fb793
commit
48ad2f1817
13 changed files with 106 additions and 12 deletions
23
entities/ISerializable.h
Normal file
23
entities/ISerializable.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef ISERIALIZABLE_H
|
||||
#define ISERIALIZABLE_H
|
||||
|
||||
#include <QDataStream>
|
||||
|
||||
|
||||
class ISerializable {
|
||||
public:
|
||||
virtual void serialize(QDataStream &output) = 0;
|
||||
virtual void deserialize(QDataStream &input) = 0;
|
||||
|
||||
friend QDataStream &operator<<(QDataStream &output, ISerializable &s) {
|
||||
s.serialize(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
friend QDataStream &operator>>(QDataStream &input, ISerializable &s) {
|
||||
s.deserialize(input);
|
||||
return input;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ISERIALIZABLE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue