diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-06-17 22:53:53 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2020-06-25 09:54:16 +0200 |
commit | d7ccd8cb4565c8643b158891c9de3187c1586dc9 (patch) | |
tree | 5f3fbd8a91cf2c460891453497f8e4b8ac2f82ba /src/corelib/text/qbytearray.cpp | |
parent | 2df4991cb1a893522caac838d6c4edf5ad8da464 (diff) |
Remove QByteArray's methods taking QString and their uses
[ChangeLog][QtCore][QByteArray] Remove method overloads taking
QString as argument, all of which were equivalent to passing the
toUtf8() of the string instead.
Change-Id: I9251733a9b3711153b2faddbbc907672a7cba190
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 196 |
1 files changed, 0 insertions, 196 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 621f2820f0..265c1fbf72 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -902,16 +902,6 @@ QByteArray qUncompress(const uchar* data, int nbytes) This issue does not apply to \l{QString}s since they represent characters using Unicode. - \section2 QString matching and insertion - - Some methods search for the content of a QString or insert a copy of it in a - QByteArray; these invariably use the UTF-8 encoding of the QString, making - them equivalent to passing \c str.toUtf8(), in place of the string \c str, - to the matching method taking a QByteArray. The overloads taking QString can - be disabled by defining \c QT_NO_CAST_TO_ASCII and \c QT_NO_CAST_FROM_ASCII, - to help catch places where unintended operations between QByteArray and - QString may cause bugs. - \sa QString, QBitArray */ @@ -1535,19 +1525,6 @@ void QByteArray::chop(int n) \sa append(), prepend() */ -/*! \fn QByteArray &QByteArray::operator+=(const QString &str) - - \overload - - Appends the UTF-8 encoding of \a str onto the end of this byte array and - returns a reference to this byte array. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn QByteArray &QByteArray::operator+=(const char *str) \overload @@ -1854,18 +1831,6 @@ QByteArray &QByteArray::append(const QByteArray &ba) return *this; } -/*! \fn QByteArray &QByteArray::append(const QString &str) - - \overload - - Appends the UTF-8 encoding of \a str to this byte array. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \overload @@ -1980,21 +1945,6 @@ QByteArray &QByteArray::insert(int i, const QByteArray &ba) } /*! - \fn QByteArray &QByteArray::insert(int i, const QString &str) - - \overload - - Inserts the UTF-8 encoding of \a str at index position \a i in the byte - array. If \a i is greater than size(), the array is first extended using - resize(). - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - -/*! \overload Inserts the '\\0'-terminated string \a str at position \a i in the byte @@ -2316,26 +2266,6 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after string \a after. */ -/*! \fn QByteArray &QByteArray::replace(const QString &before, const QByteArray &after) - - \overload - - Replaces every occurrence of the UTF-8 encoding of \a before with the byte - array \a after. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - -/*! \fn QByteArray &QByteArray::replace(const QString &before, const char *after) - \overload - - Replaces every occurrence of the UTF-8 encoding of \a before with the - '\\0'-terminated string \a after. -*/ - /*! \fn QByteArray &QByteArray::replace(const char *before, const char *after) \overload @@ -2357,19 +2287,6 @@ QByteArray &QByteArray::replace(char before, const QByteArray &after) return replace(b, 1, after.constData(), after.size()); } -/*! \fn QByteArray &QByteArray::replace(char before, const QString &after) - - \overload - - Replaces every occurrence of the byte \a before with the UTF-8 encoding of - \a after. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn QByteArray &QByteArray::replace(char before, const char *after) \overload @@ -2493,20 +2410,6 @@ int QByteArray::indexOf(const QByteArray &ba, int from) const return static_cast<int>(qFindByteArray(data(), size(), from, ba.data(), ol)); } -/*! \fn int QByteArray::indexOf(const QString &str, int from) const - - \overload - - Returns the index position of the first occurrence of the UTF-8 encoding of - \a str in the byte array, searching forward from index position \a - from. Returns -1 if \a str could not be found. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn int QByteArray::indexOf(const char *str, int from) const \overload @@ -2614,21 +2517,6 @@ int QByteArray::lastIndexOf(const QByteArray &ba, int from) const return lastIndexOfHelper(data(), size(), ba.data(), ol, from); } -/*! \fn int QByteArray::lastIndexOf(const QString &str, int from) const - - \overload - - Returns the index position of the last occurrence of the UTF-8 encoding of - \a str in the byte array, searching backward from index position \a from. If - \a from is -1 (the default), the search starts at the last byte (at index - size() - 1). Returns -1 if \a str could not be found. - - You can disable this function by defining \c QT_NO_CAST_TO_ASCII when you - compile your applications. You then need to call QString::toUtf8() (or - QString::toLatin1() or QString::toLocal8Bit()) explicitly if you want to - convert the data to \c{const char *}. -*/ - /*! \fn int QByteArray::lastIndexOf(const char *str, int from) const \overload @@ -3199,90 +3087,6 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba) } #endif // QT_NO_DATASTREAM -/*! \fn bool QByteArray::operator==(const QString &str) const - - Returns \c true if this byte array is equal to the UTF-8 encoding of \a str; - otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator!=(const QString &str) const - - Returns \c true if this byte array is not equal to the UTF-8 encoding of \a - str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator<(const QString &str) const - - Returns \c true if this byte array is lexically less than the UTF-8 encoding - of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator>(const QString &str) const - - Returns \c true if this byte array is lexically greater than the UTF-8 - encoding of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator<=(const QString &str) const - - Returns \c true if this byte array is lexically less than or equal to the - UTF-8 encoding of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - -/*! \fn bool QByteArray::operator>=(const QString &str) const - - Returns \c true if this byte array is greater than or equal to the UTF-8 - encoding of \a str; otherwise returns \c false. - - The comparison is case sensitive. - - You can disable this operator by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. You - then need to call QString::fromUtf8(), QString::fromLatin1(), - or QString::fromLocal8Bit() explicitly if you want to convert the byte - array to a QString before doing the comparison. -*/ - /*! \fn bool operator==(const QByteArray &a1, const QByteArray &a2) \relates QByteArray |