Commit 3ba2b357 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Use const references in foreach.

parent fc4f62c6
......@@ -154,11 +154,11 @@ void ResourceManager::sync()
{
QMap< QString, QList< CourseResource* > >::iterator iter;
for (iter = m_courseResources.begin(); iter != m_courseResources.end(); ++iter) {
foreach (auto courseRes, iter.value()) {
foreach (auto const &courseRes, iter.value()) {
courseRes->sync();
}
}
foreach (auto courseRes, m_skeletonResources) {
foreach (auto const &courseRes, m_skeletonResources) {
courseRes->sync();
}
}
......@@ -167,13 +167,13 @@ bool ResourceManager::modified() const
{
QMap< QString, QList< CourseResource* > >::const_iterator iter;
for (iter = m_courseResources.constBegin(); iter != m_courseResources.constEnd(); ++iter) {
foreach (auto courseRes, iter.value()) {
foreach (auto const &courseRes, iter.value()) {
if (courseRes->isOpen() && courseRes->course()->modified()) {
return true;
}
}
}
foreach (auto courseRes, m_skeletonResources) {
foreach (auto const &courseRes, m_skeletonResources) {
if (courseRes->isOpen() && courseRes->skeleton()->modified()) {
return true;
}
......
......@@ -58,9 +58,9 @@ void PhraseModel::setCourse(Course *course)
if (m_course) {
m_course->disconnect(this);
foreach (auto unit, m_course->unitList()) {
foreach (auto const &unit, m_course->unitList()) {
unit->disconnect(this);
foreach (auto phrase, unit->phraseList()) {
foreach (auto const &phrase, unit->phraseList()) {
phrase->disconnect(this);
}
}
......@@ -75,7 +75,7 @@ void PhraseModel::setCourse(Course *course)
connect(m_course, &Course::unitsRemoved, this, &PhraseModel::onUnitsRemoved);
// initial setting of signal mappings
foreach (auto unit, m_course->unitList()) {
foreach (auto const &unit, m_course->unitList()) {
// connect to phrase changes
connect(unit, &Unit::phraseAboutToBeAdded, this, &PhraseModel::onPhraseAboutToBeAdded);
connect(unit, static_cast<void (Unit::*)()>(&Unit::phraseAdded), this, &PhraseModel::onPhraseAdded);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment