Skip to content
Permalink
Browse files

Range based for loops

  • Loading branch information
m-kuhn committed Mar 10, 2019
1 parent 2ab58c9 commit d73c8ea1b5df77062a038dd0c91cdb9a2f315979
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/core/qgsrulebasedlabeling.cpp
@@ -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
@@ -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;
}
@@ -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;
@@ -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;
@@ -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();
@@ -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 )
@@ -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;
}
@@ -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 );
}
@@ -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 );
}
@@ -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() )
@@ -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;
}

0 comments on commit d73c8ea

Please sign in to comment.
You can’t perform that action at this time.