QCborError Struct

QCborError 类保存解析或验证 CBOR 流时发现的错误条件。更多

头文件: #include <QtCborCommon>
CMake.QCborError 类 find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

注意:此结构体中的所有函数都是可重入的

公共类型

enum Code { NoError, UnknownError, AdvancePastEnd, InputOutputError, GarbageAtEnd, …, UnsupportedType }

公共函数

QString toString() const
QCborError::Code operator QCborError::Code() const

详细说明

另请参阅 QCborStreamReader,QCborValue,QCborParserError,解析和显示 CBOR 数据序列化转换器以及保存和加载游戏

成员类型文档

enum QCborError::Code

该枚举包含可能的错误条件代码。

常量说明
QCborError::NoError0未检测到错误。
QCborError::UnknownError1发生未知错误,无法提供更多细节。
QCborError::AdvancePastEnd3QCborStreamReader::next(调用了(),但当前上下文中没有更多元素。
QCborError::InputOutputError4QIODevice 发生 I/O 错误。
QCborError::GarbageAtEnd256在最后一个元素之后的输入流中发现了数据。
QCborError::EndOfFile257在处理一个元素时,意外地到达了输入流的末端。
QCborError::UnexpectedBreak258CBOR 流包含不允许的 Break(数据损坏且错误无法恢复)。
QCborError::UnknownType259CBOR 流包含未知/无法解析的类型(数据已损坏,错误无法恢复)。
QCborError::IllegalType260CBOR 流在不允许存在的位置包含已知类型(数据已损坏,错误无法恢复)。
QCborError::IllegalNumber261CBOR 流编码的数字似乎大于 64 位(数据已损坏,错误无法恢复)。
QCborError::IllegalSimpleType262CBOR 流包含编码错误的简单类型(数据已损坏,错误无法恢复)。
QCborError::InvalidUtf8String516CBOR 流包含的文本字符串不能正确解码为 UTF-8(数据已损坏,错误无法恢复)。
QCborError::DataTooLarge1024CBOR 字符串、映射或数组太大,Qt 无法解析(内部限制,但错误无法恢复)。
QCborError::NestingTooDeep1025处理输入时遇到的数组或映射层级过多(内部限制,但错误不可恢复)。
QCborError::UnsupportedType1026CBOR 数据流包含一个已知类型,而该实现不支持该类型(内部限制,但该错误不可恢复)。

成员函数文档

QString QCborError::toString() const

返回与QCborError 对象中错误代码匹配的文本字符串。

注意:该字符串未经翻译。其界面允许用户解析 CBOR 流的应用程序需要提供自己的翻译字符串。

另请参阅 QCborError::Code

QCborError::Code QCborError::operator QCborError::Code() const

返回QCborError 对象存储的错误代码。

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