CoreLib: replace Java-style iterators
... with STL-style iterators or with algorithms. Java-style iterators have overhead. Change-Id: Ibeace7357c205a39dff3ca3fc0c835a026a15cac Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
27a2a02559
commit
9dcbffabbd
@ -182,10 +182,8 @@ void QMimeAllGlobPatterns::addGlob(const QMimeGlobPattern &glob)
|
||||
|
||||
void QMimeAllGlobPatterns::removeMimeType(const QString &mimeType)
|
||||
{
|
||||
QMutableHashIterator<QString, QStringList> it(m_fastPatterns);
|
||||
while (it.hasNext()) {
|
||||
it.next().value().removeAll(mimeType);
|
||||
}
|
||||
for (auto &x : m_fastPatterns)
|
||||
x.removeAll(mimeType);
|
||||
m_highWeightGlobs.removeMimeType(mimeType);
|
||||
m_lowWeightGlobs.removeMimeType(mimeType);
|
||||
}
|
||||
|
@ -130,11 +130,10 @@ public:
|
||||
*/
|
||||
void removeMimeType(const QString &mimeType)
|
||||
{
|
||||
QMutableListIterator<QMimeGlobPattern> it(*this);
|
||||
while (it.hasNext()) {
|
||||
if (it.next().mimeType() == mimeType)
|
||||
it.remove();
|
||||
}
|
||||
auto isMimeTypeEqual = [&mimeType](const QMimeGlobPattern &pattern) {
|
||||
return pattern.mimeType() == mimeType;
|
||||
};
|
||||
erase(std::remove_if(begin(), end(), isMimeTypeEqual), end());
|
||||
}
|
||||
|
||||
void match(QMimeGlobMatchResult &result, const QString &fileName) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user