diff options
author | Anton Kudryavtsev <antkudr@mail.ru> | 2017-03-19 14:01:49 +0300 |
---|---|---|
committer | Anton Kudryavtsev <antkudr@mail.ru> | 2017-03-20 06:16:59 +0000 |
commit | 1dc4c3817b79394e913170aca1f65194cbd46918 (patch) | |
tree | 0f649b8950ff1081f61e11f4d595756cb3885e45 /src/corelib/tools/qstringlist.h | |
parent | 8066ae49433ed7604e710eef7b15d15de171608e (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qstringlist.h')
-rw-r--r-- | src/corelib/tools/qstringlist.h | 7 |
1 files changed, 7 insertions, 0 deletions
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<QString>::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) { QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); |