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)
|
void QMimeAllGlobPatterns::removeMimeType(const QString &mimeType)
|
||||||
{
|
{
|
||||||
QMutableHashIterator<QString, QStringList> it(m_fastPatterns);
|
for (auto &x : m_fastPatterns)
|
||||||
while (it.hasNext()) {
|
x.removeAll(mimeType);
|
||||||
it.next().value().removeAll(mimeType);
|
|
||||||
}
|
|
||||||
m_highWeightGlobs.removeMimeType(mimeType);
|
m_highWeightGlobs.removeMimeType(mimeType);
|
||||||
m_lowWeightGlobs.removeMimeType(mimeType);
|
m_lowWeightGlobs.removeMimeType(mimeType);
|
||||||
}
|
}
|
||||||
|
@ -130,11 +130,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
void removeMimeType(const QString &mimeType)
|
void removeMimeType(const QString &mimeType)
|
||||||
{
|
{
|
||||||
QMutableListIterator<QMimeGlobPattern> it(*this);
|
auto isMimeTypeEqual = [&mimeType](const QMimeGlobPattern &pattern) {
|
||||||
while (it.hasNext()) {
|
return pattern.mimeType() == mimeType;
|
||||||
if (it.next().mimeType() == mimeType)
|
};
|
||||||
it.remove();
|
erase(std::remove_if(begin(), end(), isMimeTypeEqual), end());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void match(QMimeGlobMatchResult &result, const QString &fileName) const;
|
void match(QMimeGlobMatchResult &result, const QString &fileName) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user