Use a QMultiHash explicitly if insertMulti() is being used
This is a step towards deprecating QHash::insertMulti() and clearly separating QHash and QMultiHash. Change-Id: Ic2c7665673ff00d4f2186e94850710b70330f8ba Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
656d6f2a9b
commit
c7e35ffe69
@ -462,7 +462,7 @@ void Generator::generateCode()
|
||||
// Build extra array
|
||||
//
|
||||
QVector<QByteArray> extraList;
|
||||
QHash<QByteArray, QByteArray> knownExtraMetaObject = knownGadgets;
|
||||
QMultiHash<QByteArray, QByteArray> knownExtraMetaObject = knownGadgets;
|
||||
knownExtraMetaObject.unite(knownQObjectClasses);
|
||||
|
||||
for (int i = 0; i < cdef->propertyList.count(); ++i) {
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
QLocale::Country m_country;
|
||||
QFileInfo m_fileInfo;
|
||||
RCCFileInfo *m_parent;
|
||||
QHash<QString, RCCFileInfo*> m_children;
|
||||
QMultiHash<QString, RCCFileInfo *> m_children;
|
||||
RCCResourceLibrary::CompressionAlgorithm m_compressAlgo;
|
||||
int m_compressLevel;
|
||||
int m_compressThreshold;
|
||||
@ -737,7 +737,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
|
||||
parent->m_children.insert(node, s);
|
||||
parent = s;
|
||||
} else {
|
||||
parent = parent->m_children[node];
|
||||
parent = *parent->m_children.constFind(node);
|
||||
}
|
||||
}
|
||||
|
||||
@ -757,7 +757,7 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
|
||||
break;
|
||||
}
|
||||
}
|
||||
parent->m_children.insertMulti(filename, s);
|
||||
parent->m_children.insert(filename, s);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2573,8 +2573,8 @@ void QDomNamedNodeMapPrivate::clearMap()
|
||||
|
||||
QDomNodePrivate* QDomNamedNodeMapPrivate::namedItem(const QString& name) const
|
||||
{
|
||||
QDomNodePrivate* p = map[name];
|
||||
return p;
|
||||
auto it = map.constFind(name);
|
||||
return it == map.cend() ? nullptr : *it;
|
||||
}
|
||||
|
||||
QDomNodePrivate* QDomNamedNodeMapPrivate::namedItemNS(const QString& nsURI, const QString& localName) const
|
||||
@ -2603,7 +2603,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItem(QDomNodePrivate* arg)
|
||||
QDomNodePrivate *n = map.value(arg->nodeName());
|
||||
// We take a reference
|
||||
arg->ref.ref();
|
||||
map.insertMulti(arg->nodeName(), arg);
|
||||
map.insert(arg->nodeName(), arg);
|
||||
return n;
|
||||
}
|
||||
|
||||
@ -2620,7 +2620,7 @@ QDomNodePrivate* QDomNamedNodeMapPrivate::setNamedItemNS(QDomNodePrivate* arg)
|
||||
QDomNodePrivate *n = namedItemNS(arg->namespaceURI, arg->name);
|
||||
// We take a reference
|
||||
arg->ref.ref();
|
||||
map.insertMulti(arg->nodeName(), arg);
|
||||
map.insert(arg->nodeName(), arg);
|
||||
return n;
|
||||
} else {
|
||||
// ### check the following code if it is ok
|
||||
@ -2963,10 +2963,10 @@ QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, boo
|
||||
while (p) {
|
||||
if (p->isEntity())
|
||||
// Don't use normal insert function since we would create infinite recursion
|
||||
entities->map.insertMulti(p->nodeName(), p);
|
||||
entities->map.insert(p->nodeName(), p);
|
||||
if (p->isNotation())
|
||||
// Don't use normal insert function since we would create infinite recursion
|
||||
notations->map.insertMulti(p->nodeName(), p);
|
||||
notations->map.insert(p->nodeName(), p);
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
@ -3010,9 +3010,9 @@ QDomNodePrivate* QDomDocumentTypePrivate::insertBefore(QDomNodePrivate* newChild
|
||||
QDomNodePrivate* p = QDomNodePrivate::insertBefore(newChild, refChild);
|
||||
// Update the maps
|
||||
if (p && p->isEntity())
|
||||
entities->map.insertMulti(p->nodeName(), p);
|
||||
entities->map.insert(p->nodeName(), p);
|
||||
else if (p && p->isNotation())
|
||||
notations->map.insertMulti(p->nodeName(), p);
|
||||
notations->map.insert(p->nodeName(), p);
|
||||
|
||||
return p;
|
||||
}
|
||||
@ -3023,9 +3023,9 @@ QDomNodePrivate* QDomDocumentTypePrivate::insertAfter(QDomNodePrivate* newChild,
|
||||
QDomNodePrivate* p = QDomNodePrivate::insertAfter(newChild, refChild);
|
||||
// Update the maps
|
||||
if (p && p->isEntity())
|
||||
entities->map.insertMulti(p->nodeName(), p);
|
||||
entities->map.insert(p->nodeName(), p);
|
||||
else if (p && p->isNotation())
|
||||
notations->map.insertMulti(p->nodeName(), p);
|
||||
notations->map.insert(p->nodeName(), p);
|
||||
|
||||
return p;
|
||||
}
|
||||
@ -3042,9 +3042,9 @@ QDomNodePrivate* QDomDocumentTypePrivate::replaceChild(QDomNodePrivate* newChild
|
||||
notations->map.remove(oldChild->nodeName());
|
||||
|
||||
if (p->isEntity())
|
||||
entities->map.insertMulti(p->nodeName(), p);
|
||||
entities->map.insert(p->nodeName(), p);
|
||||
else if (p->isNotation())
|
||||
notations->map.insertMulti(p->nodeName(), p);
|
||||
notations->map.insert(p->nodeName(), p);
|
||||
}
|
||||
|
||||
return p;
|
||||
|
@ -235,7 +235,7 @@ public:
|
||||
|
||||
// Variables
|
||||
QAtomicInt ref;
|
||||
QHash<QString, QDomNodePrivate *> map;
|
||||
QMultiHash<QString, QDomNodePrivate *> map;
|
||||
QDomNodePrivate *parent;
|
||||
bool readonly;
|
||||
bool appendToParent;
|
||||
|
Loading…
Reference in New Issue
Block a user