Skip to content
Permalink
Browse files

Simpler iteration using range based loops

(cherry picked from commit c7a158f)
  • Loading branch information
nyalldawson committed Feb 19, 2021
1 parent b7b43a3 commit 99e45b41c44bf186c320025f1497ac3a90588660
Showing with 8 additions and 19 deletions.
  1. +8 −19 src/providers/wms/qgswmscapabilities.cpp
@@ -224,37 +224,26 @@ QgsWmstDimensionExtent QgsWmsSettings::parseTemporalExtent( const QString &exten
if ( extent.isNull() )
return dimensionExtent;

bool containResolution = false;
const QStringList parts = extent.split( ',' );

QStringList parts;

if ( extent.contains( ',' ) )
parts = extent.split( ',' );
else
parts.append( extent );

QStringListIterator iter( parts );

while ( iter.hasNext() )
for ( const QString &part : parts )
{
QString item = iter.next();
QStringList itemParts;
const QString item = part;

// If item contain '/' content separator, it is an interval
if ( item.contains( '/' ) )
{
itemParts = item.split( '/' );
QStringListIterator itemIter( itemParts );
QgsWmstExtentPair itemPair;
const QStringList itemParts = item.split( '/' );

QgsWmstExtentPair itemPair;
QgsWmstResolution itemResolution = itemPair.resolution;
QgsWmstDates itemDatesList = itemPair.dates;

bool itemContainResolution = false;

while ( itemIter.hasNext() )
for ( const QString &itemPart : itemParts )
{
QString itemContent = itemIter.next();
QString itemContent = itemPart;

if ( itemContent.startsWith( 'P' ) )
{
@@ -341,7 +330,7 @@ QDateTime QgsWmsSettings::findLeastClosestDateTime( const QDateTime &dateTime, b
else
seconds = closest.toSecsSinceEpoch();

for ( QgsWmstExtentPair pair : mTimeDimensionExtent.datesResolutionList )
for ( const QgsWmstExtentPair &pair : mTimeDimensionExtent.datesResolutionList )
{
if ( pair.dates.dateTimes.size() < 2 )
continue;

0 comments on commit 99e45b4

Please sign in to comment.