diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-12-07 11:52:59 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-03-08 17:07:38 +0000 |
commit | a769ab62cbcf957d049c8da74f898527dd27b328 (patch) | |
tree | a1f3607ae1472ad39fb1e8662f3781c4e669deeb /src/corelib/tools/qcollator.h | |
parent | e89fbd8c3aa50a24e5fc02ab710ccca67fce98e2 (diff) |
Extend QCollator to support QStringView
This enables some simplification of the existing implementations.
Refined wording of the documentation in the process.
[ChangeLog][QtCore][QCollator] Added support for QStringView.
Change-Id: Idffaae8d109173d47c7be076828f4b58dc334957
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qcollator.h')
-rw-r--r-- | src/corelib/tools/qcollator.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index 6fa199cb0f..700de739bb 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -109,12 +109,18 @@ public: void setIgnorePunctuation(bool on); bool ignorePunctuation() const; +#if QT_STRINGVIEW_LEVEL < 2 int compare(const QString &s1, const QString &s2) const; int compare(const QStringRef &s1, const QStringRef &s2) const; int compare(const QChar *s1, int len1, const QChar *s2, int len2) const; bool operator()(const QString &s1, const QString &s2) const { return compare(s1, s2) < 0; } +#endif + int compare(QStringView s1, QStringView s2) const; + + bool operator()(QStringView s1, QStringView s2) const + { return compare(s1, s2) < 0; } QCollatorSortKey sortKey(const QString &string) const; |