KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
iserializabletobytearray.h
1/**
2 * @brief Interface for objects that can serialize to and deserialize from a QByteArray.
3 */
4#ifndef ISERIALIZABLETOBYTEARRAY_H
5#define ISERIALIZABLETOBYTEARRAY_H
6#include <Kanoop/kanoopcommon.h>
7
8/**
9 * @brief Interface for arbitrary binary serialization into a QByteArray.
10 *
11 * Implement both serializeToByteArray() and deserializeFromByteArray() to
12 * support round-trip encoding in an application-defined binary format.
13 */
15{
16public:
17 /**
18 * @brief Populate this object by reading from a raw byte array.
19 * @param data Previously produced by serializeToByteArray()
20 */
21 virtual void deserializeFromByteArray(const QByteArray& data) = 0;
22
23 /**
24 * @brief Serialize this object into a raw byte array.
25 * @return Byte array representation of this object's state
26 */
27 virtual QByteArray serializeToByteArray() const = 0;
28};
29
30#endif // ISERIALIZABLETOBYTEARRAY_H
Interface for objects that can serialize to and deserialize from a QByteArray.
virtual void deserializeFromByteArray(const QByteArray &data)=0
Populate this object by reading from a raw byte array.
virtual QByteArray serializeToByteArray() const =0
Serialize this object into a raw byte array.