summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-11-27 18:18:07 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2020-11-30 13:56:32 +0100
commit53a1e015fdb4082900f306b5e2cca7bd5df77d03 (patch)
tree52ac877cf1cbf9b22c00bee7c831a624f2e98f37 /src
parent6109d23b4e00941343293ab702710f45be3ff965 (diff)
Inline QCollator's QString methods via QStringView
Can't be done before Qt 7 unless we do it now, as it'd be BiC. Task-number: QTBUG-86400 Pick-to: dev 6.0 Change-Id: Ib7b2e7b20b4a80b53dfc6535efe90d1674f38e81 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/text/qcollator.cpp10
-rw-r--r--src/corelib/text/qcollator.h6
2 files changed, 6 insertions, 10 deletions
diff --git a/src/corelib/text/qcollator.cpp b/src/corelib/text/qcollator.cpp
index 4bef356044..9174633e17 100644
--- a/src/corelib/text/qcollator.cpp
+++ b/src/corelib/text/qcollator.cpp
@@ -314,6 +314,7 @@ bool QCollator::ignorePunctuation() const
*/
/*!
+ \fn int QCollator::compare(const QString &s1, const QString &s2) const
\overload
Compares \a s1 with \a s2.
@@ -321,12 +322,9 @@ bool QCollator::ignorePunctuation() const
Returns an integer less than, equal to, or greater than zero depending on
whether \a s1 sorts before, with or after \a s2.
*/
-int QCollator::compare(const QString &s1, const QString &s2) const
-{
- return compare(QStringView(s1), QStringView(s2));
-}
/*!
+ \fn int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const
\overload
Compares \a s1 with \a s2. \a len1 and \a len2 specify the lengths of the
@@ -335,10 +333,6 @@ int QCollator::compare(const QString &s1, const QString &s2) const
Returns an integer less than, equal to, or greater than zero depending on
whether \a s1 sorts before, with or after \a s2.
*/
-int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const
-{
- return compare(QStringView(s1, len1), QStringView(s2, len2));
-}
#endif // QT_STRINGVIEW_LEVEL < 2
/*!
diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h
index 793d1cedd4..b3c22e3358 100644
--- a/src/corelib/text/qcollator.h
+++ b/src/corelib/text/qcollator.h
@@ -105,8 +105,10 @@ public:
bool ignorePunctuation() const;
#if QT_STRINGVIEW_LEVEL < 2
- int compare(const QString &s1, const QString &s2) const;
- int compare(const QChar *s1, int len1, const QChar *s2, int len2) const;
+ int compare(const QString &s1, const QString &s2) const
+ { return compare(QStringView(s1), QStringView(s2)); }
+ int compare(const QChar *s1, int len1, const QChar *s2, int len2) const
+ { return compare(QStringView(s1, len1), QStringView(s2, len2)); }
bool operator()(const QString &s1, const QString &s2) const
{ return compare(s1, s2) < 0; }