summaryrefslogtreecommitdiff
path: root/src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp
diff options
context:
space:
mode:
authorJochen Becher <jochen_becher@gmx.de>2018-01-13 19:35:05 +0100
committerJochen Becher <jochen_becher@gmx.de>2018-01-24 19:06:25 +0000
commiteb9172d1a0caf929bb7787e7b2cf040fe5da42eb (patch)
tree326b4d04d67c55290f48a4968c1df329f330863d /src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp
parente7d44054e151beacf4f4d4cc582ff2618c9a8914 (diff)
downloadqt-creator-eb9172d1a0caf929bb7787e7b2cf040fe5da42eb.tar.gz
Modelinglib: Avoid temporary extensive copy
Change-Id: I25fb6f671cc392836b829889987c516aa722bc92 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp')
-rw-r--r--src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp b/src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp
index ff74d61ff3..88a4520eb3 100644
--- a/src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp
+++ b/src/libs/modelinglib/qmt/model_controller/modelcontroller.cpp
@@ -1060,9 +1060,9 @@ void ModelController::renewElementKey(MElement *element, QHash<Uid, Uid> *renewe
}
auto object = dynamic_cast<MObject *>(element);
if (object) {
- foreach (const Handle<MObject> &child, object->children())
+ for (const Handle<MObject> &child : object->children())
renewElementKey(child.target(), renewedKeys);
- foreach (const Handle<MRelation> &relation, object->relations())
+ for (const Handle<MRelation> &relation : object->relations())
renewElementKey(relation.target(), renewedKeys);
}
}
@@ -1071,9 +1071,9 @@ void ModelController::renewElementKey(MElement *element, QHash<Uid, Uid> *renewe
void ModelController::updateRelationKeys(MElement *element, const QHash<Uid, Uid> &renewedKeys)
{
if (auto object = dynamic_cast<MObject *>(element)) {
- foreach (const Handle<MRelation> &handle, object->relations())
+ for (const Handle<MRelation> &handle : object->relations())
updateRelationEndKeys(handle.target(), renewedKeys);
- foreach (const Handle<MObject> &child, object->children())
+ for (const Handle<MObject> &child : object->children())
updateRelationKeys(child.target(), renewedKeys);
} else if (auto relation = dynamic_cast<MRelation *>(element)) {
updateRelationEndKeys(relation, renewedKeys);
@@ -1097,9 +1097,9 @@ void ModelController::mapObject(MObject *object)
if (object) {
QMT_CHECK(!m_objectsMap.contains(object->uid()));
m_objectsMap.insert(object->uid(), object);
- foreach (const Handle<MObject> &child, object->children())
+ for (const Handle<MObject> &child : object->children())
mapObject(child.target());
- foreach (const Handle<MRelation> &relation, object->relations())
+ for (const Handle<MRelation> &relation : object->relations())
mapRelation(relation.target());
}
}
@@ -1108,9 +1108,9 @@ void ModelController::unmapObject(MObject *object)
{
if (object) {
QMT_CHECK(m_objectsMap.contains(object->uid()));
- foreach (const Handle<MRelation> &relation, object->relations())
+ for (const Handle<MRelation> &relation : object->relations())
unmapRelation(relation.target());
- foreach (const Handle<MObject> &child, object->children())
+ for (const Handle<MObject> &child : object->children())
unmapObject(child.target());
m_objectsMap.remove(object->uid());
}
@@ -1209,7 +1209,7 @@ void ModelController::verifyModelIntegrity(const MObject *object, QHash<Uid, con
QMT_ASSERT(object, return);
QMT_ASSERT(!objectsMap->contains(object->uid()), return);
objectsMap->insert(object->uid(), object);
- foreach (const Handle<MRelation> &handle, object->relations()) {
+ for (const Handle<MRelation> &handle : object->relations()) {
MRelation *relation = handle.target();
if (relation) {
QMT_ASSERT(!relationsMap->contains(relation->uid()), return);
@@ -1222,7 +1222,7 @@ void ModelController::verifyModelIntegrity(const MObject *object, QHash<Uid, con
objectRelationsMap->insert(relation->endBUid(), relation);
}
}
- foreach (const Handle<MObject> &handle, object->children()) {
+ for (const Handle<MObject> &handle : object->children()) {
MObject *childObject = handle.target();
if (childObject)
verifyModelIntegrity(childObject, objectsMap, relationsMap, objectRelationsMap);