QProtobufSerializer Class▲
-
Header: QProtobufSerializer
-
Since: Qt 6.5
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Protobuf)
target_link_libraries(mytarget PRIVATE Qt6::Protobuf)
-
Inherits: QAbstractProtobufSerializer
I. Detailed Description▲
The QProtobufSerializer class registers serializers/deserializers for classes implementing a protobuf message, inheriting QProtobufMessage. These classes are generated automatically, based on a .proto file, using the cmake build macro qt6_add_protobuf or by running qtprotobufgen directly.
II. Member Function Documentation▲
II-1. QProtobufSerializer::QProtobufSerializer()▲
Constructs a new serializer instance.
II-2. [override virtual] QProtobufSerializer::~QProtobufSerializer()▲
Destroys the serializer instance.
II-3. [override virtual] QProtobufSerializer::DeserializationError QProtobufSerializer::deserializationError() const▲
Returns the last deserialization error.
II-4. [override virtual] QString QProtobufSerializer::deserializationErrorString() const▲
Returns a human-readable string describing the last deserialization error. If there was no error, an empty string is returned.
II-5. bool QProtobufSerializer::deserializeEnum(QtProtobuf::int64 &value, QtProtobufPrivate::QProtobufSelfcheckIterator &it) const▲
This function deserializes an enum value from a QProtobufSelfcheckIterator it. Returns true if deserialization was successful, otherwise false.
You should not call this function directly.
II-6. bool QProtobufSerializer::deserializeEnumList(QList<QtProtobuf::int64> &value, QtProtobufPrivate::QProtobufSelfcheckIterator &it) const▲
This function deserializes a list of enum value from a QProtobufSelfcheckIterator it. Returns true if deserialization was successful, otherwise false.
You should not call this function directly.
II-7. bool QProtobufSerializer::deserializeListObject(QProtobufMessage *message, const QtProtobufPrivate::QProtobufPropertyOrdering &ordering, QtProtobufPrivate::QProtobufSelfcheckIterator &it) const▲
This function deserializes an message from byte stream as part of list property, with ordering from a QProtobufSelfcheckIterator it. Returns true if deserialization was successful, otherwise false.
You should not call this function directly.
II-8. bool QProtobufSerializer::deserializeMapPair(QVariant &key, QVariant &value, QtProtobufPrivate::QProtobufSelfcheckIterator &it) const▲
This function deserializes QMap pair of key and value from a QProtobufSelfcheckIterator it. Returns true if deserialization was successful, otherwise false.
You should not call this function directly.
II-9. [override virtual] bool QProtobufSerializer::deserializeMessage(QProtobufMessage *message, const QtProtobufPrivate::QProtobufPropertyOrdering &ordering, QByteArrayView data) const▲
This is called by deserialize() to deserialize a registered Protobuf message message with ordering, from a QByteArrayView data. message can be assumed to not be nullptr. Returns true if deserialization was successful, otherwise false.
II-10. bool QProtobufSerializer::deserializeObject(QProtobufMessage *message, const QtProtobufPrivate::QProtobufPropertyOrdering &ordering, QtProtobufPrivate::QProtobufSelfcheckIterator &it) const▲
Deserialize an message with ordering from a QProtobufSelfcheckIterator it. Returns true if deserialization was successful, otherwise false.
You should not call this function directly.
II-11. QByteArray QProtobufSerializer::serializeEnum(QtProtobuf::int64 value, const QtProtobufPrivate::QProtobufPropertyOrderingInfo &fieldInfo) const▲
This function serializes value as a QByteArray for enum associated with property fieldInfo.
You should not call this function directly.
II-12. QByteArray QProtobufSerializer::serializeEnumList(const QList<QtProtobuf::int64> &value, const QtProtobufPrivate::QProtobufPropertyOrderingInfo &fieldInfo) const▲
This function serializes a list, value, as a QByteArray for enum associated with property fieldInfo.
You should not call this function directly.
II-13. QByteArray QProtobufSerializer::serializeListObject(const QProtobufMessage *message, const QtProtobufPrivate::QProtobufPropertyOrdering &ordering, const QtProtobufPrivate::QProtobufPropertyOrderingInfo &fieldInfo) const▲
This function is called to serialize message as a part of list property with ordering and fieldInfo.
You should not call this function directly.
II-14. QByteArray QProtobufSerializer::serializeMapPair(const QVariant &key, const QVariant &value, const QtProtobufPrivate::QProtobufPropertyOrderingInfo &fieldInfo) const▲
This function serializes QMap pair of key and value with fieldInfo to a QByteArray
You should not call this function directly.
II-15. [override virtual] QByteArray QProtobufSerializer::serializeMessage(const QProtobufMessage *message, const QtProtobufPrivate::QProtobufPropertyOrdering &ordering) const▲
This is called by serialize() to serialize a registered Protobuf message message with ordering. message must not be nullptr. Returns a QByteArray containing the serialized message.
II-16. QByteArray QProtobufSerializer::serializeObject(const QProtobufMessage *message, const QtProtobufPrivate::QProtobufPropertyOrdering &ordering, const QtProtobufPrivate::QProtobufPropertyOrderingInfo &fieldInfo) const▲
Serialize an message with ordering and fieldInfo. Returns a QByteArray containing the serialized message.
You should not call this function directly.
III. Related Non-Members▲
III-1. void qRegisterProtobufEnumType()▲
Registers serializers for enumeration type T in QtProtobuf global serializers registry.
This function is normally called by generated code.
III-2. void qRegisterProtobufMapType()▲
Registers a Protobuf map type K and V. V must be a QProtobufMessage. This function is normally called by generated code.
III-3. void qRegisterProtobufType()▲
Registers a Protobuf type T. This function is normally called by generated code.