From 1dc4c3817b79394e913170aca1f65194cbd46918 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Sun, 19 Mar 2017 14:01:49 +0300 Subject: QStringList: add contains(QLatin1String) overload ... to avoid the expensive conversion from QString to QL1S. [ChangeLog][QtCore][QStringList] Added contains(QLatin1String) overload. Change-Id: Ie75839ce9e46e03fe5155a02c7dcf00277b95c8d Reviewed-by: Thiago Macieira --- src/corelib/tools/qstringlist.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/corelib/tools/qstringlist.h') diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index 720d7d7419..b11856d9be 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -120,6 +120,7 @@ public: #endif inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; + inline bool contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; inline QStringList operator+(const QStringList &other) const { QStringList n = *this; n += other; return n; } @@ -165,6 +166,7 @@ namespace QtPrivate { Qt::CaseSensitivity cs); bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, const QString &str, Qt::CaseSensitivity cs); + bool Q_CORE_EXPORT QStringList_contains(const QStringList *that, QLatin1String str, Qt::CaseSensitivity cs); void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QString &before, const QString &after, Qt::CaseSensitivity cs); @@ -222,6 +224,11 @@ inline bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) co return QtPrivate::QStringList_contains(this, str, cs); } +inline bool QStringList::contains(QLatin1String str, Qt::CaseSensitivity cs) const +{ + return QtPrivate::QStringList_contains(this, str, cs); +} + inline QStringList &QListSpecialMethods::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) { QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); -- cgit v1.2.3