diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-10-17 07:31:42 -0700 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-10-29 10:13:13 +0000 |
commit | 0e0f656f5031585c6b691d80057dfdc00bc48400 (patch) | |
tree | a1924fa5e8e0ea3ab5bfc264c9b1b82583f0827e /src/corelib/tools/qstringview.h | |
parent | 81f251660026fff198daf8920edc62bbc782ff7d (diff) |
Mark the previously public qstringalgorithms.h functions private
Discussed during Qt Contributor Summit 2017. We concluded that we don't
want to make these functions public, as they do not follow Qt coding
style API. Specifically,
qStartsWith(a, b)
is not easily understood which argument is the needle and which argument
is the haystack (same problem memcpy() has). Compare that to
a.startsWith(b)
which can clearly be read in English as a subject-verb-object sentence.
This commit removes the unit tests that called compare().
Discussed-on: http://lists.qt-project.org/pipermail/development/2017-October/031060.html
Change-Id: Icaa86fc7b54d4b368c0efffd14ee6205eb9043fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/tools/qstringview.h')
-rw-r--r-- | src/corelib/tools/qstringview.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/tools/qstringview.h b/src/corelib/tools/qstringview.h index 764da71d0b..14405f325d 100644 --- a/src/corelib/tools/qstringview.h +++ b/src/corelib/tools/qstringview.h @@ -154,11 +154,11 @@ private: ++result; } #endif - return qustrlen(reinterpret_cast<const ushort *>(str)); + return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(str)); } static qssize_t lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW { - return qustrlen(reinterpret_cast<const ushort *>(str)); + return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(str)); } template <typename Char> @@ -224,9 +224,9 @@ public: // QString API // - Q_REQUIRED_RESULT QByteArray toLatin1() const { return qConvertToLatin1(*this); } - Q_REQUIRED_RESULT QByteArray toUtf8() const { return qConvertToUtf8(*this); } - Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return qConvertToLocal8Bit(*this); } + Q_REQUIRED_RESULT QByteArray toLatin1() const { return QtPrivate::convertToLatin1(*this); } + Q_REQUIRED_RESULT QByteArray toUtf8() const { return QtPrivate::convertToUtf8(*this); } + Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); } Q_REQUIRED_RESULT inline QVector<uint> toUcs4() const; // defined in qvector.h Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qssize_t n) const { return (*this)[n]; } @@ -247,23 +247,23 @@ public: Q_DECL_RELAXED_CONSTEXPR void chop(qssize_t n) { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; } - Q_REQUIRED_RESULT QStringView trimmed() const Q_DECL_NOTHROW { return qTrimmed(*this); } + Q_REQUIRED_RESULT QStringView trimmed() const Q_DECL_NOTHROW { return QtPrivate::trimmed(*this); } Q_REQUIRED_RESULT bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW - { return qStartsWith(*this, s, cs); } + { return QtPrivate::startsWith(*this, s, cs); } Q_REQUIRED_RESULT inline bool startsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; Q_REQUIRED_RESULT bool startsWith(QChar c) const Q_DECL_NOTHROW { return !empty() && front() == c; } Q_REQUIRED_RESULT bool startsWith(QChar c, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW - { return qStartsWith(*this, QStringView(&c, 1), cs); } + { return QtPrivate::startsWith(*this, QStringView(&c, 1), cs); } Q_REQUIRED_RESULT bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW - { return qEndsWith(*this, s, cs); } + { return QtPrivate::endsWith(*this, s, cs); } Q_REQUIRED_RESULT inline bool endsWith(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_DECL_NOTHROW; Q_REQUIRED_RESULT bool endsWith(QChar c) const Q_DECL_NOTHROW { return !empty() && back() == c; } Q_REQUIRED_RESULT bool endsWith(QChar c, Qt::CaseSensitivity cs) const Q_DECL_NOTHROW - { return qEndsWith(*this, QStringView(&c, 1), cs); } + { return QtPrivate::endsWith(*this, QStringView(&c, 1), cs); } // // STL compatibility API: |