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 |
(since 6.8) void | swap(QGrpcSerializationFormat &other) |
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.
Constant | Value | Description |
---|---|---|
QGrpcSerializationFormat::Default | 0 | The default QGrpcSerializationFormat preset. This preset constructs QProtobufSerializer with an empty content type suffix. |
QGrpcSerializationFormat::Protobuf | 1 | The embedded protobuf QGrpcSerializationFormat preset. This preset constructs QProtobufSerializer with the proto content type suffix. |
QGrpcSerializationFormat::Json | 2 | The embedded JSON QGrpcSerializationFormat preset. This preset constructs QProtobufJsonSerializer with the json content type suffix. |
See also suffix() and serializer().
Member Function Documentation
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.
[noexcept]
QGrpcSerializationFormat::QGrpcSerializationFormat(QGrpcSerializationFormat &&other)
Move-constructs a new QGrpcSerializationFormat from other.
Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.
[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.
[noexcept, since 6.8]
void QGrpcSerializationFormat::swap(QGrpcSerializationFormat &other)
Swaps this instance with other. This operation is very fast and never fails.
This function was introduced in Qt 6.8.
[noexcept]
QGrpcSerializationFormat &QGrpcSerializationFormat::operator=(QGrpcSerializationFormat &&other)
Move-assigns other to this QGrpcSerializationFormat instance and returns a reference to it.
Note: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.
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.