QCborStreamReader: rename toStringish() -> readAllStringish()
Amends 8af346c1f66f813c3c8fe4d8b892ecfbe96eacfb and 1d9137e13f9eb3f183c967e9e911c5b260f93dc0. Found in 6.7 API review Task-number: QTBUG-123115 Pick-to: 6.7.0 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>
This commit is contained in:
parent
2d101abed4
commit
287cff7169
@ -76,7 +76,7 @@ struct QFactoryLoaderIidSearch
|
|||||||
{
|
{
|
||||||
if (key != QtPluginMetaDataKeys::IID)
|
if (key != QtPluginMetaDataKeys::IID)
|
||||||
return skip(reader);
|
return skip(reader);
|
||||||
matchesIid = (reader.toString() == iid);
|
matchesIid = (reader.readAllString() == iid);
|
||||||
return IterationResult::FinishedSearch;
|
return IterationResult::FinishedSearch;
|
||||||
}
|
}
|
||||||
IterationResult::Result operator()(QUtf8StringView, QCborStreamReader &reader)
|
IterationResult::Result operator()(QUtf8StringView, QCborStreamReader &reader)
|
||||||
@ -109,7 +109,7 @@ struct QFactoryLoaderMetaDataKeysExtractor : QFactoryLoaderIidSearch
|
|||||||
return IterationResult::ParsingError;
|
return IterationResult::ParsingError;
|
||||||
while (reader.isValid()) {
|
while (reader.isValid()) {
|
||||||
// the metadata is JSON, so keys are all strings
|
// the metadata is JSON, so keys are all strings
|
||||||
QByteArray key = reader.toUtf8String();
|
QByteArray key = reader.readAllUtf8String();
|
||||||
if (key == "Keys") {
|
if (key == "Keys") {
|
||||||
if (!reader.isArray() || !reader.isLengthKnown())
|
if (!reader.isArray() || !reader.isLengthKnown())
|
||||||
return IterationResult::InvalidHeaderItem;
|
return IterationResult::InvalidHeaderItem;
|
||||||
@ -155,7 +155,7 @@ template <typename F> static IterationResult iterateInPluginMetaData(QByteArrayV
|
|||||||
return reader.lastError();
|
return reader.lastError();
|
||||||
r = f(key, reader);
|
r = f(key, reader);
|
||||||
} else if (reader.isString()) {
|
} else if (reader.isString()) {
|
||||||
QByteArray key = reader.toUtf8String();
|
QByteArray key = reader.readAllUtf8String();
|
||||||
if (key.isNull())
|
if (key.isNull())
|
||||||
return reader.lastError();
|
return reader.lastError();
|
||||||
r = f(QUtf8StringView(key), reader);
|
r = f(QUtf8StringView(key), reader);
|
||||||
|
@ -1299,7 +1299,7 @@ bool QCborStreamReader::leaveContainer()
|
|||||||
|
|
||||||
\snippet code/src_corelib_serialization_qcborstream.cpp 27
|
\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]
|
//! [string-no-type-conversions]
|
||||||
This function does not perform any type conversions, including from integers
|
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.
|
true; calling it in any other condition is an error.
|
||||||
//! [string-no-type-conversions]
|
//! [string-no-type-conversions]
|
||||||
|
|
||||||
\sa toString(), readByteArray(), isString(), readStringChunk()
|
\sa readAllString(), readByteArray(), isString(), readStringChunk()
|
||||||
*/
|
*/
|
||||||
QCborStreamReader::StringResult<QString> QCborStreamReader::_readString_helper()
|
QCborStreamReader::StringResult<QString> QCborStreamReader::_readString_helper()
|
||||||
{
|
{
|
||||||
@ -1336,11 +1336,11 @@ QCborStreamReader::StringResult<QString> QCborStreamReader::_readString_helper()
|
|||||||
|
|
||||||
\snippet code/src_corelib_serialization_qcborstream.cpp 27
|
\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
|
\include qcborstreamreader.cpp string-no-type-conversions
|
||||||
|
|
||||||
\sa toString(), readByteArray(), isString(), readStringChunk()
|
\sa readAllString(), readByteArray(), isString(), readStringChunk()
|
||||||
*/
|
*/
|
||||||
QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readUtf8String_helper()
|
QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readUtf8String_helper()
|
||||||
{
|
{
|
||||||
@ -1369,7 +1369,7 @@ QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readUtf8String_h
|
|||||||
|
|
||||||
\snippet code/src_corelib_serialization_qcborstream.cpp 28
|
\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]
|
//! [bytearray-no-type-conversions]
|
||||||
This function does not perform any type conversions, including from integers
|
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.
|
calling it in any other condition is an error.
|
||||||
//! [bytearray-no-type-conversions]
|
//! [bytearray-no-type-conversions]
|
||||||
|
|
||||||
\sa toByteArray(), readString(), isByteArray(), readStringChunk()
|
\sa readAllByteArray(), readString(), isByteArray(), readStringChunk()
|
||||||
*/
|
*/
|
||||||
QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readByteArray_helper()
|
QCborStreamReader::StringResult<QByteArray> QCborStreamReader::_readByteArray_helper()
|
||||||
{
|
{
|
||||||
@ -1440,7 +1440,7 @@ bool QCborStreamReaderPrivate::readFullString(ReadStringChunk params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::toString()
|
\fn QCborStreamReader::readAllString()
|
||||||
\since 6.7
|
\since 6.7
|
||||||
|
|
||||||
Decodes the current text string and returns it. If the string is chunked,
|
Decodes the current text string and returns it. If the string is chunked,
|
||||||
@ -1459,7 +1459,7 @@ bool QCborStreamReaderPrivate::readFullString(ReadStringChunk params)
|
|||||||
QIODevice.
|
QIODevice.
|
||||||
//! [note-not-restartable]
|
//! [note-not-restartable]
|
||||||
|
|
||||||
\sa readString(), readStringChunk(), isString(), toByteArray()
|
\sa readString(), readStringChunk(), isString(), readAllByteArray()
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::readAndAppendToString(QString &dst)
|
\fn QCborStreamReader::readAndAppendToString(QString &dst)
|
||||||
@ -1486,7 +1486,7 @@ bool QCborStreamReader::_readAndAppendToString_helper(QString &dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::toUtf8String()
|
\fn QCborStreamReader::readAllUtf8String()
|
||||||
\since 6.7
|
\since 6.7
|
||||||
|
|
||||||
Decodes the current text string and returns it. If the string is chunked,
|
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
|
\include qcborstreamreader.cpp note-not-restartable
|
||||||
|
|
||||||
\sa readString(), readStringChunk(), isString(), toByteArray()
|
\sa readString(), readStringChunk(), isString(), readAllByteArray()
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::readAndAppendToUtf8String(QByteArray &dst)
|
\fn QCborStreamReader::readAndAppendToUtf8String(QByteArray &dst)
|
||||||
@ -1527,7 +1527,7 @@ bool QCborStreamReader::_readAndAppendToUtf8String_helper(QByteArray &dst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QCborStreamReader::toByteArray()
|
\fn QCborStreamReader::readAllByteArray()
|
||||||
\since 6.7
|
\since 6.7
|
||||||
|
|
||||||
Decodes the current byte string and returns it. If the string is chunked,
|
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
|
\include qcborstreamreader.cpp note-not-restartable
|
||||||
|
|
||||||
\sa readByteArray(), readStringChunk(), isByteArray(), toString()
|
\sa readByteArray(), readStringChunk(), isByteArray(), readAllString()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -149,21 +149,21 @@ public:
|
|||||||
return -v - 1;
|
return -v - 1;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
QString toString()
|
QString readAllString()
|
||||||
{
|
{
|
||||||
QString dst;
|
QString dst;
|
||||||
if (!readAndAppendToString(dst))
|
if (!readAndAppendToString(dst))
|
||||||
dst = QString{};
|
dst = QString{};
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
QByteArray toUtf8String()
|
QByteArray readAllUtf8String()
|
||||||
{
|
{
|
||||||
QByteArray dst;
|
QByteArray dst;
|
||||||
if (!readAndAppendToUtf8String(dst))
|
if (!readAndAppendToUtf8String(dst))
|
||||||
dst = QByteArray{};
|
dst = QByteArray{};
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
QByteArray toByteArray()
|
QByteArray readAllByteArray()
|
||||||
{
|
{
|
||||||
QByteArray dst;
|
QByteArray dst;
|
||||||
if (!readAndAppendToByteArray(dst))
|
if (!readAndAppendToByteArray(dst))
|
||||||
|
@ -966,9 +966,9 @@ void tst_QCborStreamReader::validation()
|
|||||||
|
|
||||||
reader.reset();
|
reader.reset();
|
||||||
if (reader.isString())
|
if (reader.isString())
|
||||||
QVERIFY(reader.toString().isNull());
|
QVERIFY(reader.readAllString().isNull());
|
||||||
else
|
else
|
||||||
QVERIFY(reader.toByteArray().isNull());
|
QVERIFY(reader.readAllByteArray().isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.reset();
|
reader.reset();
|
||||||
@ -982,7 +982,7 @@ void tst_QCborStreamReader::validation()
|
|||||||
QCOMPARE(reader.lastError(), error);
|
QCOMPARE(reader.lastError(), error);
|
||||||
|
|
||||||
reader.reset();
|
reader.reset();
|
||||||
QVERIFY(reader.toUtf8String().isNull());
|
QVERIFY(reader.readAllUtf8String().isNull());
|
||||||
|
|
||||||
reader.reset();
|
reader.reset();
|
||||||
auto r = reader.readUtf8String();
|
auto r = reader.readUtf8String();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user