diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-03-10 11:06:01 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-03-29 04:30:44 +0000 |
commit | 9349ec29212a2dc36aa2460626851a16820a41b6 (patch) | |
tree | 154095216f026a5024611b68baa9cf3a6baed6f8 /src/corelib/tools/qstring.h | |
parent | 8c779f97605d667e85944898252b24e6bc00f54a (diff) |
Long live qCompareStrings()!
These free functions are designed to solve the problem that we
currently have QString::compare(QString, QString), but we have no
QString::compare(QStringRef, QString), even though we have
QString::compare(QStringRef). A compare(QString, QStringRef) only
exists in QStringRef.
This makes writing generic code tedious and error prone.
Notably absent are comparisons involving char* and QByteArray. These
will be added when we add QUtf8String, the UTF-8 counterpart to
QLatin1String.
Change-Id: I2dd7c4b1a1e0883ef0091396ee8c190012f4efba
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r-- | src/corelib/tools/qstring.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 2b7118e960..b997159e1c 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -88,8 +88,14 @@ class QStringList; class QTextCodec; class QStringRef; class QStringView; +class QLatin1String; template <typename T> class QVector; +Q_CORE_EXPORT int qCompareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW Q_REQUIRED_RESULT; +Q_CORE_EXPORT int qCompareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW Q_REQUIRED_RESULT; +Q_CORE_EXPORT int qCompareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW Q_REQUIRED_RESULT; +Q_CORE_EXPORT int qCompareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW Q_REQUIRED_RESULT; + class QLatin1String { public: |