QGrpcSerializationFormat Class
QGrpcSerializationFormat 클래스는 프로토버프 메시지 직렬화기와 관련 콘텐츠 유형 접미사를 포함합니다. 더 보기...
| 헤더: | #include <QGrpcSerializationFormat> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Grpc) target_link_libraries(mytarget PRIVATE Qt6::Grpc) |
| 다음부터: | Qt 6.8 |
QGrpcSerializationFormat 비교
| 범주 | 비교 가능한 유형 |
|---|---|
| 동등성 | QGrpcSerializationFormat |
공개 함수
| 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) | operator QVariant() const |
| QGrpcSerializationFormat & | operator=(QGrpcSerializationFormat &&other) |
| QGrpcSerializationFormat & | operator=(const QGrpcSerializationFormat &other) |
관련 비회원
(since 6.8) size_t | qHash(const QGrpcSerializationFormat &key) |
(since 6.8) size_t | qHash(const QGrpcSerializationFormat &key, size_t seed) |
(since 6.8) bool | operator!=(const QGrpcSerializationFormat &lhs, const QGrpcSerializationFormat &rhs) |
(since 6.8) QDebug | operator<<(QDebug debug, const QGrpcSerializationFormat &sfmt) |
(since 6.8) bool | operator==(const QGrpcSerializationFormat &lhs, const QGrpcSerializationFormat &rhs) |
상세 설명
QGrpcSerializationFormat 클래스에는 protobuf 메시지를 직렬화 및 역직렬화하는 데 사용되는 serializer 와, 전송 시 메시지 인코딩을 나타내는 관련 콘텐츠 유형 suffix 이 포함되어 있습니다. HTTP/2에 대한 구체적인 내용은 “ Content-Type ” 섹션을 참조하십시오.
참고: 콘텐츠 유형은 전송 계층(transport) 수준이므로 구현에 따라 다릅니다.
이 클래스는 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 로 지정된 사용자 정의 콘텐츠 유형과 protobuf 메시지 serializer 을 사용하여 새로운 QGrpcSerializationFormat 객체를 생성합니다.
QGrpcSerializationFormat::QGrpcSerializationFormat(const QGrpcSerializationFormat &other)
other 의 복사본을 생성합니다.
[constexpr noexcept default] QGrpcSerializationFormat::QGrpcSerializationFormat(QGrpcSerializationFormat &&other)
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] 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 객체를 이 객체에 할당합니다.
관련 비회원
[noexcept, since 6.8] size_t qHash(const QGrpcSerializationFormat &key)
key 0 의 해시 값을 반환하며, 계산 시 을 시드 값으로 사용합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
[noexcept, since 6.8] size_t qHash(const QGrpcSerializationFormat &key, size_t seed)
key seed 의 해시 값을 반환하며, 계산의 시드 값으로 를 사용합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
[noexcept, since 6.8] bool operator!=(const QGrpcSerializationFormat &lhs, const QGrpcSerializationFormat &rhs)
lhs 과 rhs 에 정의된 suffix 와 serializer 의 값이 서로 다를 경우, true 를 반환합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
[since 6.8] QDebug operator<<(QDebug debug, const QGrpcSerializationFormat &sfmt)
지정된 스트림 debug 에 ` sfmt `를 기록합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
[noexcept, since 6.8] bool operator==(const QGrpcSerializationFormat &lhs, const QGrpcSerializationFormat &rhs)
lhs 와 rhs 에 정의된 suffix 와 serializer 의 값이 같을 경우, true 를 반환합니다.
이 함수는 Qt 6.8에서 도입되었습니다.
© 2026 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.