KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
iserializableintodatastream.h
1/**
2 * @brief Interface for objects that can serialize to and deserialize from a QDataStream.
3 */
4#ifndef ISERIALIZABLEINTODATASTREAM_H
5#define ISERIALIZABLEINTODATASTREAM_H
6#include <Kanoop/kanoopcommon.h>
7
8/**
9 * @brief Interface for binary serialization via QDataStream.
10 *
11 * Implement both serializeIntoDataStream() and deserializeFromDataStream() to
12 * support round-trip binary encoding compatible with Qt's data stream format.
13 */
15{
16public:
17 /**
18 * @brief Populate this object by reading from a QDataStream.
19 * @param stream Source data stream positioned at the start of this object's data
20 */
21 virtual void deserializeFromDataStream(QDataStream& stream) = 0;
22
23 /**
24 * @brief Write this object's state into a QDataStream.
25 * @param stream Destination data stream to write to
26 */
27 virtual void serializeIntoDataStream(QDataStream& stream) const = 0;
28};
29
30#endif // ISERIALIZABLEINTODATASTREAM_H
Interface for objects that can serialize to and deserialize from a QDataStream.
virtual void serializeIntoDataStream(QDataStream &stream) const =0
Write this object's state into a QDataStream.
virtual void deserializeFromDataStream(QDataStream &stream)=0
Populate this object by reading from a QDataStream.