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