Revert "QLatin1String: Add overloads taking QLatin1Char"

This reverts commit 1c164ec7f2,
except for the test additions.

Reason for revert: We need to optimize the implementation, not
complicate the API.

Found during the 6.3 API review.

Pick-to: 6.3
Change-Id: I91c3f65ed6d1fc438deb0e028d578a07c0005362
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2022-01-24 08:53:55 +00:00
parent c532a57670
commit 1f118a54f8
2 changed files with 0 additions and 45 deletions

View File

@ -9301,12 +9301,6 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa operator==(), operator<(), operator>()
*/
/*!
\fn int QLatin1String::compare(QLatin1Char ch, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/
/*!
\fn bool QLatin1String::startsWith(QStringView str, Qt::CaseSensitivity cs) const
@ -9328,12 +9322,6 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa endsWith()
*/
/*!
\fn bool QLatin1String::startsWith(QLatin1Char ch, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/
/*!
\fn bool QLatin1String::endsWith(QStringView str, Qt::CaseSensitivity cs) const
\since 5.10
@ -9354,12 +9342,6 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa startsWith()
*/
/*!
\fn bool QLatin1String::endsWith(QLatin1Char ch, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/
/*!
\fn qsizetype QLatin1String::indexOf(QStringView str, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
\fn qsizetype QLatin1String::indexOf(QLatin1String l1, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
@ -9380,12 +9362,6 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa QString::indexOf()
*/
/*!
\fn qsizetype QLatin1String::indexOf(QLatin1Char ch, qsizetype from, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/
/*!
\fn bool QLatin1String::contains(QStringView str, Qt::CaseSensitivity cs) const
\fn bool QLatin1String::contains(QLatin1String l1, Qt::CaseSensitivity cs) const
@ -9403,12 +9379,6 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
QString::indexOf()
*/
/*!
\fn bool QLatin1String::contains(QLatin1Char ch, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/
/*!
\fn qsizetype QLatin1String::lastIndexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const
\fn qsizetype QLatin1String::lastIndexOf(QLatin1String l1, qsizetype from, Qt::CaseSensitivity cs) const
@ -9454,7 +9424,6 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
/*!
\fn qsizetype QLatin1String::lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const
\fn qsizetype QLatin1String::lastIndexOf(QLatin1Char ch, qsizetype from, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/

View File

@ -118,8 +118,6 @@ public:
{ return isEmpty() ? -1 : front() == c ? int(size() > 1) : uchar(m_data[0]) - c.unicode(); }
[[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::compareStrings(*this, QStringView(&c, 1), cs); }
[[nodiscard]] int compare(QLatin1Char c, Qt::CaseSensitivity cs) const noexcept
{ char ch = c.toLatin1(); return QtPrivate::compareStrings(*this, QLatin1String(&ch, 1), cs); }
[[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::startsWith(*this, s, cs); }
@ -129,8 +127,6 @@ public:
{ return !isEmpty() && front() == c; }
[[nodiscard]] inline bool startsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); }
[[nodiscard]] inline bool startsWith(QLatin1Char c, Qt::CaseSensitivity cs) const noexcept
{ char ch = c.toLatin1(); return QtPrivate::startsWith(*this, QLatin1String(&ch, 1), cs); }
[[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::endsWith(*this, s, cs); }
@ -140,8 +136,6 @@ public:
{ return !isEmpty() && back() == c; }
[[nodiscard]] inline bool endsWith(QChar c, Qt::CaseSensitivity cs) const noexcept
{ return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); }
[[nodiscard]] inline bool endsWith(QLatin1Char c, Qt::CaseSensitivity cs) const noexcept
{ char ch = c.toLatin1(); return QtPrivate::endsWith(*this, QLatin1String(&ch, 1), cs); }
[[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::findString(*this, from, s, cs); }
@ -149,8 +143,6 @@ public:
{ return QtPrivate::findString(*this, from, s, cs); }
[[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::findString(*this, from, QStringView(&c, 1), cs); }
[[nodiscard]] qsizetype indexOf(QLatin1Char c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ char ch = c.toLatin1(); return QtPrivate::findString(*this, from, QLatin1String(&ch, 1), cs); }
[[nodiscard]] bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return indexOf(s, 0, cs) != -1; }
@ -158,8 +150,6 @@ public:
{ return indexOf(s, 0, cs) != -1; }
[[nodiscard]] inline bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return indexOf(QStringView(&c, 1), 0, cs) != -1; }
[[nodiscard]] inline bool contains(QLatin1Char c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ char ch = c.toLatin1(); return indexOf(QLatin1String(&ch, 1), 0, cs) != -1; }
[[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return lastIndexOf(s, size(), cs); }
@ -173,10 +163,6 @@ public:
{ return lastIndexOf(c, -1, cs); }
[[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::lastIndexOf(*this, from, QStringView(&c, 1), cs); }
[[nodiscard]] qsizetype lastIndexOf(QLatin1Char c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return lastIndexOf(c, -1, cs); }
[[nodiscard]] qsizetype lastIndexOf(QLatin1Char c, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ char ch = c.toLatin1(); return QtPrivate::lastIndexOf(*this, from, QLatin1String(&ch, 1), cs); }
using value_type = const char;
using reference = value_type&;