diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2024-03-11 11:57:13 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-03-13 05:30:13 +0000 |
commit | 026aecf47c9aa5605054857ab3882ed0020c4ac6 (patch) | |
tree | 1e4380e558d89092f07be3fe6c37111d2433f24b | |
parent | c9556213ac5c7f108c8838e9b12337d67db3437d (diff) |
QCborStreamReader: rename toStringish() -> readAllStringish()
Amends 8af346c1f66f813c3c8fe4d8b892ecfbe96eacfb and
1d9137e13f9eb3f183c967e9e911c5b260f93dc0.
Found in 6.7 API review
Task-number: QTBUG-123115
Change-Id: I98d79274f26f3439302a59181401b6e244fe5202
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1c9e155b0571ece99ca350cc5f43af4fa8d64e4d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 287cff7169bbf164d93506a8374f0d15818b894b)
4 files changed, 21 insertions, 21 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index b1fe671fb4..8131a00a8d 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -76,7 +76,7 @@ struct QFactoryLoaderIidSearch { if (key != QtPluginMetaDataKeys::IID) return skip(reader); - matchesIid = (reader.toString() == iid); + matchesIid = (reader.readAllString() == iid); return IterationResult::FinishedSearch; } IterationResult::Result operator()(QUtf8StringView, QCborStreamReader &reader) @@ -109,7 +109,7 @@ struct QFactoryLoaderMetaDataKeysExtractor : QFactoryLoaderIidSearch return IterationResult::ParsingError; while (reader.isValid()) { // the metadata is JSON, so keys are all strings - QByteArray key = reader.toUtf8String(); + QByteArray key = reader.readAllUtf8String(); if (key == "Keys") { if (!reader.isArray() || !reader.isLengthKnown()) return IterationResult::InvalidHeaderItem; @@ -155,7 +155,7 @@ template <typename F> static IterationResult iterateInPluginMetaData(QByteArrayV return reader.lastError(); r = f(key, reader); } else if (reader.isString()) { - QByteArray key = reader.toUtf8String(); + QByteArray key = reader.readAllUtf8String(); if (key.isNull()) return reader.lastError(); r = f(QUtf8StringView(key), reader); diff --git a/src/corelib/serialization/qcborstreamreader.cpp b/src/corelib/serialization/qcborstreamreader.cpp index a775b9b98e..48772773be 100644 --- a/src/corelib/serialization/qcborstreamreader.cpp +++ b/src/corelib/serialization/qcborstreamreader.cpp @@ -1299,7 +1299,7 @@ bool QCborStreamReader::leaveContainer() \snippet code/src_corelib_serialization_qcborstream.cpp 27 - The toString() function implements the above loop and some extra checks. + The readAllString() function implements the above loop and some extra checks. //! [string-no-type-conversions] This function does not perform any type conversions, including from integers @@ -1307,7 +1307,7 @@ bool QCborStreamReader::leaveContainer() true; calling it in any other condition is an error. //! [string-no-type-conversions] - \sa toString(), readByteArray(), isString(), readStringChunk() + \sa readAllString(), readByteArray(), isString(), readStringChunk() */ QCborStreamReader::StringResult<QString> QCborStreamReader::_readString_helper() { @@ -1336,11 +1336,11 @@ QCborStreamReader::StringResult<QString> QCborStreamReader::_readString_helper() \snippet code/src_corelib_serialization_qcborstream.cpp 27 - The toUtf8String() function implements the above loop and some extra checks. + The readAllUtf8String() function implements the above loop and some extra checks. \include qcborstreamreader.cpp string-no-type-conversions - \sa toString(), readByteArray(), isString(), readStringChunk() + \sa readAllString(), readByteArray(), isString(), readStringChunk() */ QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readUtf8String_helper() { @@ -1369,7 +1369,7 @@ QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readUtf8String_h \snippet code/src_corelib_serialization_qcborstream.cpp 28 - The toByteArray() function implements the above loop and some extra checks. + The readAllByteArray() function implements the above loop and some extra checks. //! [bytearray-no-type-conversions] This function does not perform any type conversions, including from integers @@ -1377,7 +1377,7 @@ QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readUtf8String_h calling it in any other condition is an error. //! [bytearray-no-type-conversions] - \sa toByteArray(), readString(), isByteArray(), readStringChunk() + \sa readAllByteArray(), readString(), isByteArray(), readStringChunk() */ QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readByteArray_helper() { @@ -1440,7 +1440,7 @@ bool QCborStreamReaderPrivate::readFullString(ReadStringChunk params) } /*! - \fn QCborStreamReader::toString() + \fn QCborStreamReader::readAllString() \since 6.7 Decodes the current text string and returns it. If the string is chunked, @@ -1459,7 +1459,7 @@ bool QCborStreamReaderPrivate::readFullString(ReadStringChunk params) QIODevice. //! [note-not-restartable] - \sa readString(), readStringChunk(), isString(), toByteArray() + \sa readString(), readStringChunk(), isString(), readAllByteArray() */ /*! \fn QCborStreamReader::readAndAppendToString(QString &dst) @@ -1486,7 +1486,7 @@ bool QCborStreamReader::_readAndAppendToString_helper(QString &dst) } /*! - \fn QCborStreamReader::toUtf8String() + \fn QCborStreamReader::readAllUtf8String() \since 6.7 Decodes the current text string and returns it. If the string is chunked, @@ -1499,7 +1499,7 @@ bool QCborStreamReader::_readAndAppendToString_helper(QString &dst) \include qcborstreamreader.cpp note-not-restartable - \sa readString(), readStringChunk(), isString(), toByteArray() + \sa readString(), readStringChunk(), isString(), readAllByteArray() */ /*! \fn QCborStreamReader::readAndAppendToUtf8String(QByteArray &dst) @@ -1527,7 +1527,7 @@ bool QCborStreamReader::_readAndAppendToUtf8String_helper(QByteArray &dst) } /*! - \fn QCborStreamReader::toByteArray() + \fn QCborStreamReader::readAllByteArray() \since 6.7 Decodes the current byte string and returns it. If the string is chunked, @@ -1540,7 +1540,7 @@ bool QCborStreamReader::_readAndAppendToUtf8String_helper(QByteArray &dst) \include qcborstreamreader.cpp note-not-restartable - \sa readByteArray(), readStringChunk(), isByteArray(), toString() + \sa readByteArray(), readStringChunk(), isByteArray(), readAllString() */ /*! diff --git a/src/corelib/serialization/qcborstreamreader.h b/src/corelib/serialization/qcborstreamreader.h index 52803fd841..2666b7c7b2 100644 --- a/src/corelib/serialization/qcborstreamreader.h +++ b/src/corelib/serialization/qcborstreamreader.h @@ -149,21 +149,21 @@ public: return -v - 1; return v; } - QString toString() + QString readAllString() { QString dst; if (!readAndAppendToString(dst)) dst = QString{}; return dst; } - QByteArray toUtf8String() + QByteArray readAllUtf8String() { QByteArray dst; if (!readAndAppendToUtf8String(dst)) dst = QByteArray{}; return dst; } - QByteArray toByteArray() + QByteArray readAllByteArray() { QByteArray dst; if (!readAndAppendToByteArray(dst)) diff --git a/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp b/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp index b7ee05882e..3a5acfdf83 100644 --- a/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp +++ b/tests/auto/corelib/serialization/qcborstreamreader/tst_qcborstreamreader.cpp @@ -966,9 +966,9 @@ void tst_QCborStreamReader::validation() reader.reset(); if (reader.isString()) - QVERIFY(reader.toString().isNull()); + QVERIFY(reader.readAllString().isNull()); else - QVERIFY(reader.toByteArray().isNull()); + QVERIFY(reader.readAllByteArray().isNull()); } reader.reset(); @@ -982,7 +982,7 @@ void tst_QCborStreamReader::validation() QCOMPARE(reader.lastError(), error); reader.reset(); - QVERIFY(reader.toUtf8String().isNull()); + QVERIFY(reader.readAllUtf8String().isNull()); reader.reset(); auto r = reader.readUtf8String(); |