QCborStreamReader: rename appendToType() -> readAndAppendToType()
Amends ff034ebbfa7c1cc47cdcc15bc854972cd960db1a. Found in 6.7 API review Task-number: QTBUG-123115 Pick-to: 6.7.0 Change-Id: Id5e95aacffcb633701d4d635d2bf8af70984903e Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cc911328648929552664707d7beccaa87fc96564) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2b13207c2e
commit
2d101abed4
@ -1462,7 +1462,7 @@ bool QCborStreamReaderPrivate::readFullString(ReadStringChunk params)
|
|||||||
\sa readString(), readStringChunk(), isString(), toByteArray()
|
\sa readString(), readStringChunk(), isString(), toByteArray()
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::appendToString(QString &dst)
|
\fn QCborStreamReader::readAndAppendToString(QString &dst)
|
||||||
\since 6.7
|
\since 6.7
|
||||||
|
|
||||||
Decodes the current text string and appends to \a dst. If the string is
|
Decodes the current text string and appends to \a dst. If the string is
|
||||||
@ -1475,9 +1475,9 @@ bool QCborStreamReaderPrivate::readFullString(ReadStringChunk params)
|
|||||||
|
|
||||||
\include qcborstreamreader.cpp note-not-restartable
|
\include qcborstreamreader.cpp note-not-restartable
|
||||||
|
|
||||||
\sa readString(), readStringChunk(), isString(), appendToByteArray()
|
\sa readString(), readStringChunk(), isString(), readAndAppendToByteArray()
|
||||||
*/
|
*/
|
||||||
bool QCborStreamReader::_appendToString_helper(QString &dst)
|
bool QCborStreamReader::_readAndAppendToString_helper(QString &dst)
|
||||||
{
|
{
|
||||||
bool ok = d->readFullString(&dst);
|
bool ok = d->readFullString(&dst);
|
||||||
if (ok)
|
if (ok)
|
||||||
@ -1502,7 +1502,7 @@ bool QCborStreamReader::_appendToString_helper(QString &dst)
|
|||||||
\sa readString(), readStringChunk(), isString(), toByteArray()
|
\sa readString(), readStringChunk(), isString(), toByteArray()
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::appendToUtf8String(QByteArray &dst)
|
\fn QCborStreamReader::readAndAppendToUtf8String(QByteArray &dst)
|
||||||
\since 6.7
|
\since 6.7
|
||||||
|
|
||||||
Decodes the current text string and appends to \a dst. If the string is
|
Decodes the current text string and appends to \a dst. If the string is
|
||||||
@ -1515,9 +1515,9 @@ bool QCborStreamReader::_appendToString_helper(QString &dst)
|
|||||||
|
|
||||||
\include qcborstreamreader.cpp note-not-restartable
|
\include qcborstreamreader.cpp note-not-restartable
|
||||||
|
|
||||||
\sa readString(), readStringChunk(), isString(), appendToByteArray()
|
\sa readString(), readStringChunk(), isString(), readAndAppendToByteArray()
|
||||||
*/
|
*/
|
||||||
bool QCborStreamReader::_appendToUtf8String_helper(QByteArray &dst)
|
bool QCborStreamReader::_readAndAppendToUtf8String_helper(QByteArray &dst)
|
||||||
{
|
{
|
||||||
using P = QCborStreamReaderPrivate::ReadStringChunk;
|
using P = QCborStreamReaderPrivate::ReadStringChunk;
|
||||||
bool ok = d->readFullString({ &dst, P::Utf8String });
|
bool ok = d->readFullString({ &dst, P::Utf8String });
|
||||||
@ -1544,7 +1544,7 @@ bool QCborStreamReader::_appendToUtf8String_helper(QByteArray &dst)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::appendToByteArray(QByteArray &dst)
|
\fn QCborStreamReader::readAndAppendToByteArray(QByteArray &dst)
|
||||||
\since 6.7
|
\since 6.7
|
||||||
|
|
||||||
Decodes the current byte string and appends to \a dst. If the string is
|
Decodes the current byte string and appends to \a dst. If the string is
|
||||||
@ -1557,9 +1557,9 @@ bool QCborStreamReader::_appendToUtf8String_helper(QByteArray &dst)
|
|||||||
|
|
||||||
\include qcborstreamreader.cpp note-not-restartable
|
\include qcborstreamreader.cpp note-not-restartable
|
||||||
|
|
||||||
\sa readByteArray(), readStringChunk(), isByteArray(), appendToString()
|
\sa readByteArray(), readStringChunk(), isByteArray(), readAndAppendToString()
|
||||||
*/
|
*/
|
||||||
bool QCborStreamReader::_appendToByteArray_helper(QByteArray &dst)
|
bool QCborStreamReader::_readAndAppendToByteArray_helper(QByteArray &dst)
|
||||||
{
|
{
|
||||||
bool ok = d->readFullString(&dst);
|
bool ok = d->readFullString(&dst);
|
||||||
if (ok)
|
if (ok)
|
||||||
|
@ -120,9 +120,12 @@ public:
|
|||||||
bool enterContainer() { Q_ASSERT(isContainer()); return _enterContainer_helper(); }
|
bool enterContainer() { Q_ASSERT(isContainer()); return _enterContainer_helper(); }
|
||||||
bool leaveContainer();
|
bool leaveContainer();
|
||||||
|
|
||||||
bool appendToString(QString &dst) { Q_ASSERT(isString()); return _appendToString_helper(dst); }
|
bool readAndAppendToString(QString &dst)
|
||||||
bool appendToUtf8String(QByteArray &dst){ Q_ASSERT(isString()); return _appendToUtf8String_helper(dst); }
|
{ Q_ASSERT(isString()); return _readAndAppendToString_helper(dst); }
|
||||||
bool appendToByteArray(QByteArray &dst) { Q_ASSERT(isByteArray()); return _appendToByteArray_helper(dst); }
|
bool readAndAppendToUtf8String(QByteArray &dst)
|
||||||
|
{ Q_ASSERT(isString()); return _readAndAppendToUtf8String_helper(dst); }
|
||||||
|
bool readAndAppendToByteArray(QByteArray &dst)
|
||||||
|
{ Q_ASSERT(isByteArray()); return _readAndAppendToByteArray_helper(dst); }
|
||||||
StringResult<QString> readString() { Q_ASSERT(isString()); return _readString_helper(); }
|
StringResult<QString> readString() { Q_ASSERT(isString()); return _readString_helper(); }
|
||||||
StringResult<QByteArray> readUtf8String() { Q_ASSERT(isString()); return _readUtf8String_helper(); }
|
StringResult<QByteArray> readUtf8String() { Q_ASSERT(isString()); return _readUtf8String_helper(); }
|
||||||
StringResult<QByteArray> readByteArray(){ Q_ASSERT(isByteArray()); return _readByteArray_helper(); }
|
StringResult<QByteArray> readByteArray(){ Q_ASSERT(isByteArray()); return _readByteArray_helper(); }
|
||||||
@ -149,21 +152,21 @@ public:
|
|||||||
QString toString()
|
QString toString()
|
||||||
{
|
{
|
||||||
QString dst;
|
QString dst;
|
||||||
if (!appendToString(dst))
|
if (!readAndAppendToString(dst))
|
||||||
dst = QString{};
|
dst = QString{};
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
QByteArray toUtf8String()
|
QByteArray toUtf8String()
|
||||||
{
|
{
|
||||||
QByteArray dst;
|
QByteArray dst;
|
||||||
if (!appendToUtf8String(dst))
|
if (!readAndAppendToUtf8String(dst))
|
||||||
dst = QByteArray{};
|
dst = QByteArray{};
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
QByteArray toByteArray()
|
QByteArray toByteArray()
|
||||||
{
|
{
|
||||||
QByteArray dst;
|
QByteArray dst;
|
||||||
if (!appendToByteArray(dst))
|
if (!readAndAppendToByteArray(dst))
|
||||||
dst = QByteArray{};
|
dst = QByteArray{};
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
@ -175,9 +178,9 @@ private:
|
|||||||
StringResult<QByteArray> _readUtf8String_helper();
|
StringResult<QByteArray> _readUtf8String_helper();
|
||||||
StringResult<QByteArray> _readByteArray_helper();
|
StringResult<QByteArray> _readByteArray_helper();
|
||||||
qsizetype _currentStringChunkSize() const;
|
qsizetype _currentStringChunkSize() const;
|
||||||
bool _appendToString_helper(QString &);
|
bool _readAndAppendToString_helper(QString &);
|
||||||
bool _appendToUtf8String_helper(QByteArray &);
|
bool _readAndAppendToUtf8String_helper(QByteArray &);
|
||||||
bool _appendToByteArray_helper(QByteArray &);
|
bool _readAndAppendToByteArray_helper(QByteArray &);
|
||||||
|
|
||||||
template <typename FP> FP _toFloatingPoint() const noexcept
|
template <typename FP> FP _toFloatingPoint() const noexcept
|
||||||
{
|
{
|
||||||
|
@ -699,12 +699,12 @@ void tst_QCborStreamReader::strings()
|
|||||||
if (reader.isByteArray()) {
|
if (reader.isByteArray()) {
|
||||||
QByteArray prefix("some prefix");
|
QByteArray prefix("some prefix");
|
||||||
QByteArray ba = prefix;
|
QByteArray ba = prefix;
|
||||||
QVERIFY(reader.appendToByteArray(ba));
|
QVERIFY(reader.readAndAppendToByteArray(ba));
|
||||||
QCOMPARE(ba, prefix + fullString);
|
QCOMPARE(ba, prefix + fullString);
|
||||||
} else {
|
} else {
|
||||||
QString prefix("some prefix");
|
QString prefix("some prefix");
|
||||||
QString str = prefix;
|
QString str = prefix;
|
||||||
QVERIFY(reader.appendToString(str));
|
QVERIFY(reader.readAndAppendToString(str));
|
||||||
QCOMPARE(str, prefix + QString::fromUtf8(fullString));
|
QCOMPARE(str, prefix + QString::fromUtf8(fullString));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ void tst_QCborStreamReader::strings()
|
|||||||
if (reader.isString()) {
|
if (reader.isString()) {
|
||||||
QByteArray prefix("some prefix");
|
QByteArray prefix("some prefix");
|
||||||
QByteArray utf8 = prefix;
|
QByteArray utf8 = prefix;
|
||||||
QVERIFY(reader.appendToUtf8String(utf8));
|
QVERIFY(reader.readAndAppendToUtf8String(utf8));
|
||||||
QCOMPARE(utf8, prefix + fullString);
|
QCOMPARE(utf8, prefix + fullString);
|
||||||
|
|
||||||
reader.reset();
|
reader.reset();
|
||||||
@ -954,12 +954,12 @@ void tst_QCborStreamReader::validation()
|
|||||||
if (reader.isString()) {
|
if (reader.isString()) {
|
||||||
QString prefix = "some prefix";
|
QString prefix = "some prefix";
|
||||||
QString str = prefix;
|
QString str = prefix;
|
||||||
QVERIFY(!reader.appendToString(str));
|
QVERIFY(!reader.readAndAppendToString(str));
|
||||||
QVERIFY(str.startsWith(prefix)); // but may have decoded some
|
QVERIFY(str.startsWith(prefix)); // but may have decoded some
|
||||||
} else if (reader.isByteArray()) {
|
} else if (reader.isByteArray()) {
|
||||||
QByteArray prefix = "some prefix";
|
QByteArray prefix = "some prefix";
|
||||||
QByteArray ba = prefix;
|
QByteArray ba = prefix;
|
||||||
QVERIFY(!reader.appendToByteArray(ba));
|
QVERIFY(!reader.readAndAppendToByteArray(ba));
|
||||||
QVERIFY(ba.startsWith(prefix)); // but may have decoded some
|
QVERIFY(ba.startsWith(prefix)); // but may have decoded some
|
||||||
}
|
}
|
||||||
QCOMPARE(reader.lastError(), error);
|
QCOMPARE(reader.lastError(), error);
|
||||||
@ -977,7 +977,7 @@ void tst_QCborStreamReader::validation()
|
|||||||
if (reader.isString()) {
|
if (reader.isString()) {
|
||||||
QByteArray prefix = "some prefix";
|
QByteArray prefix = "some prefix";
|
||||||
QByteArray ba = prefix;
|
QByteArray ba = prefix;
|
||||||
QVERIFY(!reader.appendToUtf8String(ba));
|
QVERIFY(!reader.readAndAppendToUtf8String(ba));
|
||||||
QVERIFY(ba.startsWith(prefix)); // but may have decoded some
|
QVERIFY(ba.startsWith(prefix)); // but may have decoded some
|
||||||
QCOMPARE(reader.lastError(), error);
|
QCOMPARE(reader.lastError(), error);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user