FromBase64Result Class

(QByteArray::FromBase64Result)

The QByteArray::FromBase64Result class holds the result of a call to QByteArray::fromBase64Encoding. More...

Header: #include <FromBase64Result>
qmake: QT += core
Since: Qt 5.15

Public Variables

QByteArray decoded
QByteArray::Base64DecodingStatus decodingStatus

Detailed Description

The QByteArray::FromBase64Result class holds the result of a call to QByteArray::fromBase64Encoding.

Objects of this class can be used to check whether the conversion was successful, and if so, retrieve the decoded QByteArray. The conversion operators defined for QByteArray::FromBase64Result make its usage straightforward:

 void process(const QByteArray &);

 if (auto result = QByteArray::fromBase64Encoding(encodedData))
     process(*result);

Alternatively, it is possible to access the conversion status and the decoded data directly:

 auto result = QByteArray::fromBase64Encoding(encodedData);
 if (result.decodingStatus == QByteArray::Base64DecodingStatus::Ok)
     process(result.decoded);

See also QByteArray::fromBase64.

Member Variable Documentation

QByteArray FromBase64Result::decoded

Contains the decoded byte array.

QByteArray::Base64DecodingStatus FromBase64Result::decodingStatus

Contains whether the decoding was successful, expressed as a value of type QByteArray::Base64DecodingStatus.