이 페이지에서

QProtobufSerializer Class

QProtobufSerializer 클래스는 직렬화 및 역직렬화를 위한 기본 기능을 제공하는 인터페이스입니다. 더 보기...

헤더: #include <QProtobufSerializer>
CMake: find_package(Qt6 REQUIRED COMPONENTS Protobuf)
target_link_libraries(mytarget PRIVATE Qt6::Protobuf)
다음과 같이: Qt 6.5
상속: QAbstractProtobufSerializer

공개 함수

QProtobufSerializer()
virtual ~QProtobufSerializer() override
(since 6.7) void shouldPreserveUnknownFields(bool preserveUnknownFields)

재구현된 공용 함수

virtual QAbstractProtobufSerializer::Error lastError() const override
virtual QString lastErrorString() const override

상세 설명

QProtobufSerializer 클래스는 QProtobufMessage 를 상속하여 protobuf 메시지를 구현하는 클래스에 대한 직렬화기/역직렬화기를 등록합니다. 이러한 클래스는 .proto 파일을 기반으로 CMake 함수 qt_add_protobuf를 사용하거나 qtprotobufgen을 직접 실행하여 자동으로 생성됩니다.

멤버 함수 문서

QProtobufSerializer::QProtobufSerializer()

새로운 직렬화기 인스턴스를 생성합니다.

[override virtual noexcept] QProtobufSerializer::~QProtobufSerializer()

시리얼라이저 인스턴스를 파기합니다.

[override virtual] QAbstractProtobufSerializer::Error QProtobufSerializer::lastError() const

QAbstractProtobufSerializer::lastError() const를 재구현합니다.

시리얼라이저 인스턴스에 대해 발생한 마지막 역직렬화 오류를 반환합니다.

lastErrorString()도 참조하십시오 .

[override virtual] QString QProtobufSerializer::lastErrorString() const

QAbstractProtobufSerializer::lastErrorString() const를 재구현합니다.

시리얼라이저 인스턴스에 대한 마지막 역직렬화 오류 문자열을 반환합니다.

lastError()도 참조하십시오 .

[since 6.7] void QProtobufSerializer::shouldPreserveUnknownFields(bool preserveUnknownFields)

preserveUnknownFields 에 따라, 통신선을 통해 수신된 알 수 없는 필드를 결과 메시지에 저장할지, 아니면 생략할지 여부를 제어합니다.

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

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