QCborError Struct

The QCborError class holds the error condition found while parsing or validating a CBOR stream. More...

Header: #include <QtCborCommon>
qmake: QT += core
Since: Qt 5.12

This struct was introduced in Qt 5.12.

Note: All functions in this struct are reentrant.

Public Types

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

Public Functions

QString toString() const
Code operator Code() const

Detailed Description

See also QCborStreamReader, QCborValue, and QCborParserError.

Member Type Documentation

enum QCborError::Code

This enum contains the possible error condition codes.

ConstantValueDescription
QCborError::NoError0No error was detected.
QCborError::UnknownError1An unknown error occurred and no further details are available.
QCborError::AdvancePastEnd3QCborStreamReader::next() was called but there are no more elements in the current context.
QCborError::InputOutputError4An I/O error with the QIODevice occurred.
QCborError::GarbageAtEnd256Data was found in the input stream after the last element.
QCborError::EndOfFile257The end of the input stream was unexpectedly reached while processing an element.
QCborError::UnexpectedBreak258The CBOR stream contains a Break where it is not allowed (data is corrupt and the error is not recoverable).
QCborError::UnknownType259The CBOR stream contains an unknown/unparsable Type (data is corrupt and the and the error is not recoverable).
QCborError::IllegalType260The CBOR stream contains a known type in a position it is not allowed to exist (data is corrupt and the error is not recoverable).
QCborError::IllegalNumber261The CBOR stream appears to be encoding a number larger than 64-bit (data is corrupt and the error is not recoverable).
QCborError::IllegalSimpleType262The CBOR stream contains a Simple Type encoded incorrectly (data is corrupt and the error is not recoverable).
QCborError::InvalidUtf8String516The CBOR stream contains a text string that does not decode properly as UTF-8 (data is corrupt and the error is not recoverable).
QCborError::DataTooLarge1024CBOR string, map or array is too big and cannot be parsed by Qt (internal limitation, but the error is not recoverable).
QCborError::NestingTooDeep1025Too many levels of arrays or maps encountered while processing the input (internal limitation, but the error is not recoverable).
QCborError::UnsupportedType1026The CBOR stream contains a known type that the implementation does not support (internal limitation, but the error is not recoverable).

Member Function Documentation

QString QCborError::toString() const

Returns a text string that matches the error code in this QCborError object.

Note: the string is not translated. Applications whose interface allow users to parse CBOR streams need to provide their own, translated strings.

See also QCborError::Code.

Code QCborError::operator Code() const

Returns the error code that this QCborError object stores.