Skip to content
Permalink
Browse files

...and DEFINITELY no 'foreach'!!

  • Loading branch information
nyalldawson committed Mar 21, 2021
1 parent 2559555 commit 55a79ac1e71582df13731ee1cdf603a524e965dc
@@ -82,7 +82,7 @@ static jboolean startQtApp( JNIEnv *env, jobject /*object*/, jstring paramsStrin
env->ReleaseStringUTFChars( environmentString, nativeString );
m_applicationParams = string.split( '\t' );
qDebug() << "environmentString" << string << m_applicationParams;
foreach ( string, m_applicationParams )
for ( string : m_applicationParams )
if ( putenv( string.constData() ) )
qWarning() << "Can't set environment" << string;

@@ -7351,7 +7351,7 @@ const QStringList &QgsExpression::BuiltinFunctions()


QgsArrayForeachExpressionFunction::QgsArrayForeachExpressionFunction()
: QgsExpressionFunction( QStringLiteral( "array_foreach" ), QgsExpressionFunction::ParameterList()
: QgsExpressionFunction( QStringLiteral( "array_foreach" ), QgsExpressionFunction::ParameterList() // skip-keyword-check
<< QgsExpressionFunction::Parameter( QStringLiteral( "array" ) )
<< QgsExpressionFunction::Parameter( QStringLiteral( "expression" ) ),
QStringLiteral( "Arrays" ) )
@@ -522,7 +522,7 @@ class QgsStaticExpressionFunction : public QgsExpressionFunction
};

/**
* \brief Handles the ``array_foreach(array, expression)`` expression function.
* \brief Handles the array looping``array_Foreach(array, expression)`` expression function.
* It temporarily appends a new scope to the expression context.
*
* \ingroup core
@@ -1660,7 +1660,7 @@ std::size_t FeaturePart::createCandidatesForPolygon( std::vector< std::unique_pt
std::vector< OrientedConvexHullBoundingBox > boxes;
boxes.reserve( shapes_final.size() );

// Compute bounding box foreach finalShape
// Compute bounding box for each finalShape
while ( !shapes_final.isEmpty() )
{
PointSet *shape = shapes_final.takeFirst();
@@ -311,7 +311,7 @@ std::unique_ptr<Problem> Pal::extract( const QgsRectangle &extent, const QgsGeom
}

int idlp = 0;
for ( std::size_t i = 0; i < prob->mFeatureCount; i++ ) /* foreach feature into prob */
for ( std::size_t i = 0; i < prob->mFeatureCount; i++ ) /* for each feature into prob */
{
std::unique_ptr< Feats > feat = std::move( features.front() );
features.pop_front();
@@ -424,7 +424,7 @@ std::unique_ptr<Problem> Pal::extract( const QgsRectangle &extent, const QgsGeom

double amin[2];
double amax[2];
while ( !features.empty() ) // foreach feature
while ( !features.empty() ) // for each feature
{
if ( isCanceled() )
return nullptr;
@@ -90,7 +90,7 @@ void Problem::reduce()
for ( i = 0; i < static_cast< int >( mFeatureCount ); i++ )
{
// ok[i] = true;
for ( j = 0; j < mFeatNbLp[i]; j++ ) // foreach candidate
for ( j = 0; j < mFeatNbLp[i]; j++ ) // for each candidate
{
if ( !ok[mFeatStartId[i] + j] )
{
@@ -503,7 +503,7 @@ inline Chain *Problem::chain( int seed )
{
conflicts.clear();
}
} // end foreach labelposition
} // end for each labelposition

if ( next_seed == -1 )
{
@@ -455,7 +455,7 @@ QgsGrassGisLib::Raster QgsGrassGisLib::raster( QString name )
{
QgsDebugMsg( "name = " + name );

foreach ( Raster raster, mRasters )
for ( Raster raster : mRasters )
{
if ( raster.name == name ) return raster;
}
@@ -498,7 +498,7 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature &feature )
case PktFidMap:
{
QVariantList primaryKeyVals;
foreach ( int idx, mSource->mPrimaryKeyAttrs )
for ( int idx : mSource->mPrimaryKeyAttrs )
{
QgsField fld = mSource->mFields.at( idx );

@@ -657,14 +657,14 @@ int QOCISpatialResultPrivate::bindValue( OCIStmt *sql, OCIBind **hbnd, OCIError
geometryInd->elem_info = g.eleminfo.size() == 0 ? OCI_IND_NULL : OCI_IND_NOTNULL;
geometryInd->ordinates = g.ordinates.size() == 0 ? OCI_IND_NULL : OCI_IND_NOTNULL;

foreach ( int e, g.eleminfo )
for ( int e : g.eleminfo )
{
OCINumber n;
OCI_VERIFY_E( err, OCINumberFromInt( err, &e, sizeof( int ), OCI_NUMBER_SIGNED, &n ) );
OCI_VERIFY_E( err, OCICollAppend( env, err, &n, nullptr, geometryObj->elem_info ) );
}

foreach ( double o, g.ordinates )
for ( double o : g.ordinates )
{
OCINumber n;
OCI_VERIFY_E( err, OCINumberFromReal( err, &o, sizeof( double ), &n ) );
@@ -1734,8 +1734,8 @@ namespace QgsWms
parentElem.appendChild( nameElem );
}

QList<QgsAttributeEditorElement *> children = container->children();
foreach ( const QgsAttributeEditorElement *child, children )
const QList<QgsAttributeEditorElement *> children = container->children();
for ( const QgsAttributeEditorElement *child : children )
{
if ( child->type() == QgsAttributeEditorElement::AeTypeContainer )
{
@@ -134,6 +134,9 @@ HINTS[36]="Use \brief instead (works correct with Python docstrings)"
KEYWORDS[37]="Q_FOREACH"
HINTS[37]="Use range based for loops instead"

KEYWORDS[38]="foreach"
HINTS[38]="Use range based for loops instead"

RES=
DIR=$(git rev-parse --show-toplevel)

0 comments on commit 55a79ac

Please sign in to comment.