QProtobufSerializer Class

The QProtobufSerializer class is interface that represents basic functions for serialization/deserialization. 更多...

头: #include <QProtobufSerializer>
CMake: find_package(Qt6 REQUIRED COMPONENTS Protobuf)
target_link_libraries(mytarget PRIVATE Qt6::Protobuf)
Since: Qt 6.5
继承: QAbstractProtobufSerializer

公共函数

QProtobufSerializer ()
virtual ~QProtobufSerializer () override
(从 6.7 起) void shouldPreserveUnknownFields (bool preserveUnknownFields )

重实现公共函数

virtual QAbstractProtobufSerializer::Error lastError () const override
virtual QString lastErrorString () const override

详细描述

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 function qt_add_protobuf or by running qtprotobufgen 直接。

成员函数文档编制

QProtobufSerializer:: QProtobufSerializer ()

Constructs a new serializer instance.

[override virtual noexcept] QProtobufSerializer:: ~QProtobufSerializer ()

Destroys the serializer instance.

[override virtual] QAbstractProtobufSerializer::Error QProtobufSerializer:: lastError () const

重实现: QAbstractProtobufSerializer::lastError () const.

Returns the last deserialization error for the serializer instance.

另请参阅 lastErrorString ().

[override virtual] QString QProtobufSerializer:: lastErrorString () const

重实现: QAbstractProtobufSerializer::lastErrorString () const.

Returns the last deserialization error string for the serializer instance.

另请参阅 lastError ().

[since 6.7] void QProtobufSerializer:: shouldPreserveUnknownFields ( bool preserveUnknownFields )

Controls whether the unknown fields received from the wire should be stored in the resulting message or if it should be omitted, based on preserveUnknownFields .

该函数在 Qt 6.7 引入。