QGrpcSerializationFormat Class

The QGrpcSerializationFormat class holds the protobuf message serializer and the related content type suffix. More...

Header: #include <QGrpcSerializationFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
Since: Qt 6.8
Status: Technical Preview

Public Types

enum Format { Default, Protobuf, Json }

Public Functions

QGrpcSerializationFormat(QGrpcSerializationFormat::Format format = Format::Default)
QGrpcSerializationFormat(QByteArrayView suffix, std::shared_ptr<QAbstractProtobufSerializer> serializer)
QGrpcSerializationFormat(const QGrpcSerializationFormat &other)
QGrpcSerializationFormat(QGrpcSerializationFormat &&other)
~QGrpcSerializationFormat()
std::shared_ptr<QAbstractProtobufSerializer> serializer() const
QByteArray suffix() const
QGrpcSerializationFormat &operator=(QGrpcSerializationFormat &&other)
QGrpcSerializationFormat &operator=(const QGrpcSerializationFormat &other)

Detailed Description

Provides a serializer and the content type assigned to it to QAbstractGrpcChannel implementations.

To set serializer format, use either one of the existing presets or the user serializer.

See also QAbstractGrpcChannel.

Member Type Documentation

enum QGrpcSerializationFormat::Format

Holds presets for setting the protobuf serializer format.

ConstantValueDescription
QGrpcSerializationFormat::Default0The default QGrpcSerializationFormat preset. This preset constructs QProtobufSerializer with an empty content type suffix.
QGrpcSerializationFormat::Protobuf1The embedded protobuf QGrpcSerializationFormat preset. This preset constructs QProtobufSerializer with the proto content type suffix.
QGrpcSerializationFormat::Json2The embedded JSON QGrpcSerializationFormat preset. This preset constructs QProtobufJsonSerializer with the json content type suffix.

See also suffix() and serializer().

Member Function Documentation

[explicit] QGrpcSerializationFormat::QGrpcSerializationFormat(QGrpcSerializationFormat::Format format = Format::Default)

Creates a new QGrpcSerializationFormat object with the given preset format.

The QGrpcSerializationFormat::Default format is used by default.

QGrpcSerializationFormat::QGrpcSerializationFormat(QByteArrayView suffix, std::shared_ptr<QAbstractProtobufSerializer> serializer)

Creates a new QGrpcSerializationFormat object with the custom content type suffix and serializer.

QGrpcSerializationFormat::QGrpcSerializationFormat(const QGrpcSerializationFormat &other)

Constructs a copy of other.

QGrpcSerializationFormat::QGrpcSerializationFormat(QGrpcSerializationFormat &&other)

Move-constructs a QGrpcSerializationFormat instance from other.

[noexcept] QGrpcSerializationFormat::~QGrpcSerializationFormat()

Destroys the QGrpcSerializationFormat object.

[noexcept] std::shared_ptr<QAbstractProtobufSerializer> QGrpcSerializationFormat::serializer() const

Returns the serializer for this serialization format.

/sa QAbstractProtobufSerializer

[noexcept] QByteArray QGrpcSerializationFormat::suffix() const

Returns the content type suffix for this serialization format.

QGrpcSerializationFormat &QGrpcSerializationFormat::operator=(QGrpcSerializationFormat &&other)

Moves the other QGrpcSerializationFormat object to this one.

QGrpcSerializationFormat &QGrpcSerializationFormat::operator=(const QGrpcSerializationFormat &other)

Assigns the other QGrpcSerializationFormat object to this one.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.