QCborStreamWriter: add append(QByteArrayView)
This required demoting the QByteArray overload to Q_WEAK_OVERLOAD to avoid introducing ambiguities. [ChangeLog][QtCore][QCborStreamWriter] Added a QByteArrayView overload of append(). Change-Id: I3004bd691aca990cb67dfffde63b58bb378e3311 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This commit is contained in:
parent
07a15916cc
commit
c17a934197
@ -1380,6 +1380,8 @@ QUuid::Version QUuid::version() const noexcept
|
||||
|
||||
#if QT_CORE_REMOVED_SINCE(6, 10)
|
||||
|
||||
#include "qcborstreamwriter.h" // Q_WEAK_OVERLOAD added
|
||||
|
||||
#include "qcoreapplication.h"
|
||||
|
||||
#if QT_CONFIG(permissions)
|
||||
|
@ -397,6 +397,7 @@ void QCborStreamWriter::append(QCborNegativeInteger n)
|
||||
|
||||
/*!
|
||||
\fn void QCborStreamWriter::append(const QByteArray &ba)
|
||||
\fn void QCborStreamWriter::append(QByteArrayView ba)
|
||||
\overload
|
||||
|
||||
Appends the byte array \a ba to the stream, creating a CBOR Byte String
|
||||
@ -411,6 +412,9 @@ void QCborStreamWriter::append(QCborNegativeInteger n)
|
||||
As the example shows, unlike JSON, CBOR requires no escaping for binary
|
||||
content.
|
||||
|
||||
\note The overload taking a \l QByteArrayView has been present since Qt
|
||||
6.10.
|
||||
|
||||
\sa appendByteString(), QCborStreamReader::isByteArray(),
|
||||
QCborStreamReader::readByteArray()
|
||||
*/
|
||||
|
@ -42,7 +42,11 @@ public:
|
||||
void append(quint64 u);
|
||||
void append(qint64 i);
|
||||
void append(QCborNegativeInteger n);
|
||||
#if !QT_CORE_REMOVED_SINCE(6, 10) // wasn't a template until 6.10
|
||||
Q_WEAK_OVERLOAD
|
||||
#endif
|
||||
void append(const QByteArray &ba) { appendByteString(ba.constData(), ba.size()); }
|
||||
void append(QByteArrayView ba) { appendByteString(ba.data(), ba.size()); }
|
||||
void append(QLatin1StringView str);
|
||||
void append(QStringView str);
|
||||
void append(QCborTag tag);
|
||||
|
Loading…
x
Reference in New Issue
Block a user