QGrpcSerializationFormat Class

QGrpcSerializationFormat 클래스는 프로토부프 메시지 직렬화기와 관련 콘텐츠 유형 접미사를 보유합니다. 더 보기...

헤더: #include <QGrpcSerializationFormat>
CMake: find_package(Qt6 REQUIRED COMPONENTS Grpc)
target_link_libraries(mytarget PRIVATE Qt6::Grpc)
이후 Qt 6.8

이 클래스는 동등 비교가 가능합니다.

공용 함수

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)
(since 6.8) QDebug operator<<(QDebug debug, const QGrpcSerializationFormat &sfmt)

상세 설명

QGrpcSerializationFormat 클래스에는 프로토뷰 메시지를 직렬화 및 역직렬화하는 데 사용되는 serializer 와 전송 시 메시지 인코딩을 나타내는 관련 콘텐츠 유형 suffix 이 포함되어 있습니다. HTTP/2 관련 세부 사항은 Content-Type 섹션을 참조하세요.

참고: 콘텐츠 유형은 전송이므로 구현에 따라 다릅니다.

SerializationFormat 사전 설정 또는 사용자 정의 접미사 및 직렬화기 중 하나를 사용하여 클래스를 구성할 수 있습니다:

QGrpcSerializationFormat jsonFormat(QtGrpc::SerializationFormat::Json);

이렇게 하면 json 접미사가 붙은 QProtobufJsonSerializer 이 생성됩니다. HTTP/2 전송의 경우 application/grpc+json 콘텐츠 유형이 생성됩니다.

class DummySerializer : public QAbstractProtobufSerializer
{
    ...
};
QGrpcSerializationFormat dummyFormat("dummy", std::make_shared<DummySerializer>());

dummy 접미사가 있는 메시지를 인코딩 및 디코딩할 때 DummySerializer 을 사용합니다. HTTP/2 전송의 경우 application/grpc+dummy 콘텐츠 유형이 생성됩니다.

참고: 사용자 정의 직렬화기를 사용하려면 지정된 형식에 대한 서버 지원이 필요합니다.

QGrpcChannelOptions::serializationFormat참조하세요 .

멤버 함수 문서

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

지정된 프리셋 format 으로 새로운 QGrpcSerializationFormat을 생성합니다.

기본 포맷은 SerializationFormat::Default 입니다.

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

suffix 에 지정된 사용자 정의 콘텐츠 유형과 프로토뷰 메시지 serializer 를 사용하여 새로운 QGrpcSerializationFormat을 구축합니다.

QGrpcSerializationFormat::QGrpcSerializationFormat(const QGrpcSerializationFormat &other)

other 의 복사본을 생성합니다.

[noexcept] QGrpcSerializationFormat::QGrpcSerializationFormat(QGrpcSerializationFormat &&other)

Move는 other 에서 새 QGrpcSerializationFormat을 생성합니다.

참고: 이동한 개체 other 는 부분적으로 형성된 상태로 배치되며, 유효한 작업은 파괴와 새 값 할당뿐입니다.

[noexcept] QGrpcSerializationFormat::~QGrpcSerializationFormat()

QGrpcSerializationFormat 를 파괴합니다.

std::shared_ptr<QAbstractProtobufSerializer> QGrpcSerializationFormat::serializer() const

이 직렬화 형식에 대한 직렬화기를 반환합니다.

/sa QAbstractProtobufSerializer

[noexcept] QByteArrayView QGrpcSerializationFormat::suffix() const

이 직렬화 형식의 콘텐츠 유형 접미사를 반환합니다.

[noexcept, since 6.8] void QGrpcSerializationFormat::swap(QGrpcSerializationFormat &other)

other 를 이 객체로 바꿉니다. 이 작업은 매우 빠르며 실패하지 않습니다.

이 함수는 Qt 6.8에 도입되었습니다.

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

이 객체에서 새 QVariant 을 만듭니다.

이 함수는 Qt 6.8에 도입되었습니다.

[noexcept] QGrpcSerializationFormat &QGrpcSerializationFormat::operator=(QGrpcSerializationFormat &&other)

이동 - other 을 이 QGrpcSerializationFormat 인스턴스에 할당하고 참조를 반환합니다.

참고: 이동된 other 객체는 부분적으로 형성된 상태로 배치되며, 유효한 작업은 소멸과 새 값 할당뿐입니다.

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

other QGrpcSerializationFormat 객체를 이 객체에 할당합니다.

관련 비회원

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

sfmt 을 지정된 스트림 debug 에 씁니다.

이 함수는 Qt 6.8에 도입되었습니다.

© 2025 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.