Skip to content

Commit

Permalink
Use remove_if
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 18, 2019
1 parent dad5b75 commit 63c0278
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/server/services/wms/qgswmsparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,12 +1502,12 @@ namespace QgsWms
{
QList<QgsWmsParametersExternalLayer> externalLayers;

for ( const QString &layer : allLayersNickname() )
{
if ( ! isExternalLayer( layer ) )
continue;
QStringList layers = allLayersNickname();
QStringList::const_iterator rit = std::remove_if( layers.begin(), layers.end(), QgsWmsParameters::isExternalLayer );

externalLayers << externalLayerParameter( layer );
for ( QStringList::const_iterator it = layers.begin(); it != rit; ++it )
{
externalLayers << externalLayerParameter( *it );
}

return externalLayers;
Expand Down Expand Up @@ -1813,7 +1813,7 @@ namespace QgsWms
return param;
}

bool QgsWmsParameters::isExternalLayer( const QString &name ) const
bool QgsWmsParameters::isExternalLayer( const QString &name )
{
return name.startsWith( EXTERNAL_LAYER_PREFIX );
}
Expand Down
3 changes: 2 additions & 1 deletion src/server/services/wms/qgswmsparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,8 @@ namespace QgsWms
QStringList atlasPk() const;

private:
static bool isExternalLayer( const QString &name );

bool loadParameter( const QString &name, const QString &value ) override;

void save( const QgsWmsParameter &parameter, bool multi = false );
Expand All @@ -1187,7 +1189,6 @@ namespace QgsWms
void raiseError( const QString &msg ) const;
void log( const QString &msg ) const;

bool isExternalLayer( const QString &name ) const;
QgsWmsParametersExternalLayer externalLayerParameter( const QString &name ) const;

QMultiMap<QString, QgsWmsParametersFilter> layerFilters( const QStringList &layers ) const;
Expand Down

0 comments on commit 63c0278

Please sign in to comment.