From 1f118a54f8c5518328d7492c86ed1fc9b2a6ebcd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 24 Jan 2022 08:53:55 +0000 Subject: Revert "QLatin1String: Add overloads taking QLatin1Char" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1c164ec7f21a78025475c561a70b94d1e3dd6bb6, 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 --- src/corelib/text/qstring.cpp | 31 ------------------------------- src/corelib/text/qstring.h | 14 -------------- 2 files changed, 45 deletions(-) (limited to 'src') diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 437b31089d..8fd9dc96cf 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -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 */ diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index e886f1182b..8eb0dd630f 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -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&; -- cgit v1.2.3