Skip to content

Commit

Permalink
Range based for loops
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 10, 2019
1 parent 2ab58c9 commit d73c8ea
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/core/qgsrulebasedlabeling.cpp
Expand Up @@ -29,7 +29,7 @@ QgsVectorLayerLabelProvider *QgsRuleBasedLabelProvider::createProvider( QgsVecto

bool QgsRuleBasedLabelProvider::prepare( const QgsRenderContext &context, QSet<QString> &attributeNames )
{
Q_FOREACH ( QgsVectorLayerLabelProvider *provider, mSubProviders )
for ( QgsVectorLayerLabelProvider *provider : qgis::as_const( mSubProviders ) )
provider->setEngine( mEngine );

// populate sub-providers
Expand All @@ -46,7 +46,7 @@ void QgsRuleBasedLabelProvider::registerFeature( const QgsFeature &feature, QgsR
QList<QgsAbstractLabelProvider *> QgsRuleBasedLabelProvider::subProviders()
{
QList<QgsAbstractLabelProvider *> lst;
Q_FOREACH ( QgsVectorLayerLabelProvider *subprovider, mSubProviders )
for ( QgsVectorLayerLabelProvider *subprovider : qgis::as_const( mSubProviders ) )
lst << subprovider;
return lst;
}
Expand Down Expand Up @@ -111,7 +111,7 @@ void QgsRuleBasedLabeling::Rule::initFilter()
void QgsRuleBasedLabeling::Rule::updateElseRules()
{
mElseRules.clear();
Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : qgis::as_const( mChildren ) )
{
if ( rule->isElse() )
mElseRules << rule;
Expand All @@ -123,7 +123,7 @@ bool QgsRuleBasedLabeling::Rule::requiresAdvancedEffects() const
if ( mSettings && mSettings->format().containsAdvancedEffects() )
return true;

Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : qgis::as_const( mChildren ) )
{
if ( rule->requiresAdvancedEffects() )
return true;
Expand All @@ -134,7 +134,7 @@ bool QgsRuleBasedLabeling::Rule::requiresAdvancedEffects() const

void QgsRuleBasedLabeling::Rule::subProviderIds( QStringList &list ) const
{
Q_FOREACH ( const Rule *rule, mChildren )
for ( const Rule *rule : qgis::as_const( mChildren ) )
{
if ( rule->settings() )
list << rule->ruleKey();
Expand Down Expand Up @@ -172,7 +172,7 @@ const QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::Rule::findRuleByKey( con
if ( key == mRuleKey )
return this;

Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : mChildren )
{
const Rule *r = rule->findRuleByKey( key );
if ( r )
Expand Down Expand Up @@ -201,7 +201,7 @@ QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::Rule::clone() const
Rule *newrule = new Rule( s, mMaximumScale, mMinimumScale, mFilterExp, mDescription );
newrule->setActive( mIsActive );
// clone children
Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : mChildren )
newrule->appendChild( rule->clone() );
return newrule;
}
Expand Down Expand Up @@ -285,7 +285,7 @@ void QgsRuleBasedLabeling::Rule::createSubProviders( QgsVectorLayer *layer, QgsR
}

// call recursively
Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : qgis::as_const( mChildren ) )
{
rule->createSubProviders( layer, subProviders, provider );
}
Expand All @@ -310,7 +310,7 @@ void QgsRuleBasedLabeling::Rule::prepare( const QgsRenderContext &context, QSet<
}

// call recursively
Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : qgis::as_const( mChildren ) )
{
rule->prepare( context, attributeNames, subProviders );
}
Expand All @@ -334,7 +334,7 @@ QgsRuleBasedLabeling::Rule::RegisterResult QgsRuleBasedLabeling::Rule::registerF
bool willRegisterSomething = false;

// call recursively
Q_FOREACH ( Rule *rule, mChildren )
for ( Rule *rule : qgis::as_const( mChildren ) )
{
// Don't process else rules yet
if ( !rule->isElse() )
Expand All @@ -349,7 +349,7 @@ QgsRuleBasedLabeling::Rule::RegisterResult QgsRuleBasedLabeling::Rule::registerF
// If none of the rules passed then we jump into the else rules and process them.
if ( !willRegisterSomething )
{
Q_FOREACH ( Rule *rule, mElseRules )
for ( Rule *rule : qgis::as_const( mElseRules ) )
{
registered |= rule->registerFeature( feature, context, subProviders, obstacleGeometry ) != Filtered;
}
Expand Down

0 comments on commit d73c8ea

Please sign in to comment.