QGrpcSerializationFormat Class | Qt GRPC 6.8.0
Description: The QGrpcSerializationFormat class holds the protobuf message serializer and the related content type suffix.

- Qt 6.8
- Qt GRPC
- C++ Classes
- QtGrpc (Technical Preview)
- QGrpcSerializationFormat
- Qt 6.8.0 Reference Documentation

# 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

- List of all members, including inherited members

This class is equality-comparable.

## Public Functions

| QGrpcSerializationFormat(QtGrpc::SerializationFormat format = {})
| QGrpcSerializationFormat(QByteArrayView suffix, std::shared_ptr<QAbstractProtobufSerializer> serializer)
| QGrpcSerializationFormat(const QGrpcSerializationFormat &other)
| QGrpcSerializationFormat(QGrpcSerializationFormat &&other)
| ~QGrpcSerializationFormat()
std::shared_ptr<QAbstractProtobufSerializer> | serializer() const
QByteArrayView | suffix() const
`(since 6.8)` void | swap(QGrpcSerializationFormat &other)
`(since 6.8)` QVariant | operator QVariant() const
QGrpcSerializationFormat & | operator=(QGrpcSerializationFormat &&other)
QGrpcSerializationFormat & | operator=(const QGrpcSerializationFormat &other)

## Related Non-Members

`(since 6.8)` QDebug | operator<<(QDebug debug, const QGrpcSerializationFormat &sfmt)

## 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 Function Documentation

### QGrpcSerializationFormat::QGrpcSerializationFormat(QtGrpc::SerializationFormat format = {})

Creates a new QGrpcSerializationFormat object with the given preset format.

A QtGrpc::SerializationFormat::Default format is used by default.

### `[explicit]` 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]` QByteArrayView 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.

### `[since 6.8]` QVariant QGrpcSerializationFormat::operator QVariant() const

Constructs a new QVariant object from this QGrpcSerializationFormat.

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.

## Related Non-Members

### `[since 6.8]` QDebug operator<<(QDebug debug, const QGrpcSerializationFormat &sfmt)

Writes sfmt to the specified stream debug.

This function was introduced in Qt 6.8.