The QAbstractProtobufSerializer class is interface that represents basic functions for serialization/deserialization. More...
#include <qabstractprotobufserializer.h>
Public Member Functions | |
template<typename T > | |
QByteArray | serialize (const QObject *object) |
Serialization of a registered qtproto message object into byte-array. More... | |
template<typename T > | |
void | deserialize (T *object, const QByteArray &data) |
Deserialization of a byte-array into a registered qtproto message object. More... | |
virtual QByteArray | serializeMessage (const QObject *object, const QProtobufMetaObject &metaObject) const =0 |
serializeMessage More... | |
virtual void | deserializeMessage (QObject *object, const QProtobufMetaObject &metaObject, const QByteArray &data) const =0 |
serializeMessage More... | |
virtual QByteArray | serializeObject (const QObject *object, const QProtobufMetaObject &metaObject, const QProtobufMetaProperty &metaProperty) const =0 |
serializeObject Serializes complete object according given propertyOrdering and metaObject information More... | |
virtual void | deserializeObject (QObject *object, const QProtobufMetaObject &metaObject, QProtobufSelfcheckIterator &it) const =0 |
deserializeObject Deserializes buffer to an object More... | |
virtual QByteArray | serializeListBegin (const QProtobufMetaProperty &metaProperty) const |
serializeListBegin Method called at the begining of object list serialization More... | |
virtual QByteArray | serializeListObject (const QObject *object, const QProtobufMetaObject &metaObject, const QProtobufMetaProperty &metaProperty) const =0 |
serializeListObject Method called to serialize object as a part of list property More... | |
virtual QByteArray | serializeListEnd (QByteArray &buffer, const QProtobufMetaProperty &metaProperty) const |
serializeListEnd Method called at the end of object list serialization More... | |
virtual bool | deserializeListObject (QObject *object, const QProtobufMetaObject &metaObject, QProtobufSelfcheckIterator &it) const =0 |
deserializeListObject Deserializes an object from byte stream as part of list property More... | |
virtual QByteArray | serializeMapBegin (const QProtobufMetaProperty &metaProperty) const |
serializeMapEnd Method called at the begining of map serialization More... | |
virtual QByteArray | serializeMapPair (const QVariant &key, const QVariant &value, const QProtobufMetaProperty &metaProperty) const =0 |
serializeMapPair Serializes QMap pair of key and value to raw data buffer More... | |
virtual QByteArray | serializeMapEnd (QByteArray &buffer, const QProtobufMetaProperty &metaProperty) const |
serializeMapEnd Method called at the end of map serialization More... | |
virtual bool | deserializeMapPair (QVariant &key, QVariant &value, QProtobufSelfcheckIterator &it) const =0 |
deserializeMapPair Deserializes QMap pair of key and value from raw data More... | |
virtual QByteArray | serializeEnum (int64 value, const QMetaEnum &metaEnum, const QtProtobuf::QProtobufMetaProperty &metaProperty) const =0 |
serializeEnum Serializes enum value represented as int64 type More... | |
virtual QByteArray | serializeEnumList (const QList< int64 > &value, const QMetaEnum &metaEnum, const QtProtobuf::QProtobufMetaProperty &metaProperty) const =0 |
serializeEnumList Method called to serialize list of enum values More... | |
virtual void | deserializeEnum (int64 &value, const QMetaEnum &metaEnum, QProtobufSelfcheckIterator &it) const =0 |
deserializeEnum Deserializes enum value from byte stream More... | |
virtual void | deserializeEnumList (QList< int64 > &value, const QMetaEnum &metaEnum, QProtobufSelfcheckIterator &it) const =0 |
deserializeEnum Deserializes list of enum values from byte stream More... | |
The QAbstractProtobufSerializer class is interface that represents basic functions for serialization/deserialization.
The QAbstractProtobufSerializer class registers serializers/deserializers for classes inherited of QObject. To register serializers for user-defined class it has to be inherited of QObject and contains Q_DECLARE_PROTOBUF_SERIALIZERS macro's.
Practically code above is generated automaticaly by running qtprotobufgenerator or using cmake build macro qtprotobuf_generate, based on .proto files. But it's still possible to reuse manually written code if needed.
This class should be used as base for specific serializers. The handlers property contains all message-specific serializers and should be used while serialization/deserialization. Inherited classes should reimplement scope of virtual methods that used by registred message serialization/deserialization functions.
|
inline |
Deserialization of a byte-array into a registered qtproto message object.
Properties in a message are identified via ProtobufObjectPrivate::decodeHeader. Bytes corresponding to unexpected properties are skipped without any exception
[out] | object | Pointer to memory where result of deserialization should be injected |
[in] | data | Bytes with serialized message |
|
pure virtual |
deserializeEnum Deserializes enum value from byte stream
[out] | value | Buffer that will be used to collect new enum value |
[in] | metaEnum | Information about enumeration type |
[in] | it | Points to serialized raw key/value data |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
deserializeEnum Deserializes list of enum values from byte stream
[out] | value | QList that will be used to collect deserialized enum values |
[in] | metaEnum | Information about enumeration type |
[in] | it | Points to serialized raw key/value data |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
deserializeListObject Deserializes an object from byte stream as part of list property
[out] | object | Pointer to pre-allocated object, that will be appended to list property |
[in] | Protobuf | meta object information for given object. Static meta object usualy is used to get actual property value and write new property to object |
[in] | it | Pointer to beging of buffer where object serialized data is located |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
deserializeMapPair Deserializes QMap pair of key and value from raw data
[out] | key | Buffer that will be used to store deserialized key. When passed to function, QVariant already stores default constructed value. So it's possible to receive meta information about type from it. |
[out] | value | Buffer that will be used to store deserialized value. When passed to function, QVariant already stores default constructed value. So it's possible to receive meta information about type from it. |
[in] | it | Points to serialized raw key/value data |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
serializeMessage
object | |
propertyOrdering | |
metaObject |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
deserializeObject Deserializes buffer to an object
[out] | object | Pointer to pre-allocated object |
[in] | metaObject | Protobuf meta object information for given object. Static meta object usualy is used to get actual property value and write new property to object |
[in] | it | Pointer to beging of buffer where object serialized data is located |
[in] | propertyOrdering | Ordering of properties for given object |
[in] | metaProperty | Information about property to be serialized |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
inline |
Serialization of a registered qtproto message object into byte-array.
[in] | object | Pointer to QObject containing message to be serialized |
|
pure virtual |
serializeEnum Serializes enum value represented as int64 type
[in] | value | Enum value to be serialized |
[in] | metaEnum | Information about enumeration type |
[in] | metaProperty | Information about property to be serialized |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
serializeEnumList Method called to serialize list of enum values
[in] | value | List of enum values to be serialized, represented as int64 |
[in] | metaEnum | Information about enumeration type |
[in] | metaProperty | Information about property to be serialized |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
inlinevirtual |
serializeListBegin Method called at the begining of object list serialization
[in] | metaProperty | Information about property to be serialized |
Reimplemented in QtProtobuf::QProtobufJsonSerializer.
|
inlinevirtual |
serializeListEnd Method called at the end of object list serialization
[in] | buffer | Buffer at and of list serialization |
[in] | metaProperty | Information about property to be serialized |
Reimplemented in QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
serializeListObject Method called to serialize object as a part of list property
[in] | object | Pointer to object that will be serialized |
[in] | metaObject | Protobuf meta object information for given object |
[in] | metaProperty | Information about property to be serialized |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
inlinevirtual |
serializeMapEnd Method called at the begining of map serialization
[in] | metaProperty | Information about property to be serialized |
Reimplemented in QtProtobuf::QProtobufJsonSerializer.
|
inlinevirtual |
serializeMapEnd Method called at the end of map serialization
[in] | buffer | Buffer at and of list serialization |
[in] | metaProperty | Information about property to be serialized |
Reimplemented in QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
serializeMapPair Serializes QMap pair of key and value to raw data buffer
[in] | key | Map key |
[in] | value | Map value for given key |
[in] | metaProperty | Information about property to be serialized |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
serializeMessage
object | |
propertyOrdering | |
metaObject |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.
|
pure virtual |
serializeObject Serializes complete object according given propertyOrdering and metaObject information
[in] | object | Pointer to object to be serialized |
[in] | metaObject | Protobuf meta object information for given object |
[in] | metaProperty | Information about property to be serialized |
Implemented in QtProtobuf::QProtobufSerializer, and QtProtobuf::QProtobufJsonSerializer.