Skip to content
Permalink
Browse files

Merge pull request #3659 from nyalldawson/clazy3

Fix clazy level 0 checks
  • Loading branch information
nyalldawson committed Oct 22, 2016
2 parents 6acf0f7 + 1dca938 commit ec25df1565962c4a92ffc3b72b8abefc92bb87ef
Showing with 171 additions and 178 deletions.
  1. +1 −1 python/gui/editorwidgets/core/qgseditorwidgetfactory.sip
  2. +2 −2 src/app/main.cpp
  3. +1 −1 src/app/openstreetmap/qgsosmimportdialog.cpp
  4. +0 −1 src/app/pluginmanager/qgspluginmanager.cpp
  5. +5 −4 src/app/qgisapp.cpp
  6. +4 −4 src/app/qgsbookmarks.cpp
  7. +1 −1 src/app/qgsfeatureaction.cpp
  8. +1 −1 src/app/qgsfeatureaction.h
  9. +1 −1 src/app/qgshandlebadlayers.cpp
  10. +1 −1 src/app/qgsmaptoolreshape.cpp
  11. +3 −3 src/app/qgsprojectproperties.cpp
  12. +1 −1 src/core/geometry/qgsgeometry.cpp
  13. +1 −1 src/core/geometry/qgsgeometry.h
  14. +2 −2 src/core/geometry/qgsgeometryeditutils.cpp
  15. +1 −1 src/core/geometry/qgsgeometryeditutils.h
  16. +1 −1 src/core/gps/qgsgpsdetector.cpp
  17. +1 −1 src/core/qgscolorramp.cpp
  18. +3 −3 src/core/qgscoordinatereferencesystem.cpp
  19. +3 −3 src/core/qgsdistancearea.cpp
  20. +7 −3 src/core/qgsexpression.cpp
  21. +1 −1 src/core/qgsgml.cpp
  22. +4 −4 src/core/qgsjsonutils.cpp
  23. +7 −6 src/core/qgsogcutils.cpp
  24. +2 −2 src/core/qgssqlstatement.cpp
  25. +2 −2 src/core/qgsstringutils.cpp
  26. +2 −2 src/core/qgsvectorfilewriter.cpp
  27. +1 −1 src/core/qgsvectorlayer.cpp
  28. +3 −1 src/core/qgsvectorlayerundocommand.cpp
  29. +1 −1 src/gui/attributetable/qgsdualview.cpp
  30. +1 −1 src/gui/editorwidgets/core/qgseditorwidgetfactory.h
  31. +2 −2 src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
  32. +2 −2 src/gui/editorwidgets/qgscheckboxwidgetfactory.cpp
  33. +1 −1 src/gui/editorwidgets/qgscheckboxwidgetfactory.h
  34. +2 −2 src/gui/editorwidgets/qgsdatetimeeditfactory.cpp
  35. +1 −1 src/gui/editorwidgets/qgsdatetimeeditfactory.h
  36. +2 −2 src/gui/editorwidgets/qgsrangewidgetfactory.cpp
  37. +1 −1 src/gui/editorwidgets/qgsrangewidgetfactory.h
  38. +2 −2 src/gui/editorwidgets/qgsrelationreferencefactory.cpp
  39. +1 −1 src/gui/editorwidgets/qgsrelationreferencefactory.h
  40. +2 −4 src/gui/editorwidgets/qgsvaluemapwidgetfactory.cpp
  41. +1 −1 src/gui/editorwidgets/qgsvaluemapwidgetfactory.h
  42. +2 −2 src/gui/qgsattributeform.cpp
  43. +2 −2 src/gui/qgscodeeditorpython.cpp
  44. +2 −2 src/gui/qgscolorbutton.cpp
  45. +5 −5 src/gui/qgsprojectionselector.cpp
  46. +2 −2 src/gui/symbology-ng/qgsrulebasedrendererwidget.cpp
  47. +2 −2 src/gui/symbology-ng/qgsrulebasedrendererwidget.h
  48. +2 −2 src/gui/symbology-ng/qgssymbollayerwidget.cpp
  49. +1 −1 src/plugins/georeferencer/qgsgeorefvalidators.cpp
  50. +2 −2 src/plugins/grass/qgsgrassmodule.cpp
  51. +1 −9 src/plugins/grass/qgsgrassmoduleparam.cpp
  52. +3 −4 src/plugins/grass/qgsgrassplugin.cpp
  53. +1 −2 src/plugins/grass/qgsgrassselect.cpp
  54. +2 −2 src/providers/arcgisrest/qgsafsdataitems.cpp
  55. +1 −1 src/providers/arcgisrest/qgsafsprovider.cpp
  56. +2 −2 src/providers/arcgisrest/qgsafssourceselect.cpp
  57. +2 −2 src/providers/arcgisrest/qgsamsdataitems.cpp
  58. +5 −5 src/providers/arcgisrest/qgsamsprovider.cpp
  59. +2 −2 src/providers/arcgisrest/qgsamssourceselect.cpp
  60. +1 −1 src/providers/arcgisrest/qgsarcgisrestutils.cpp
  61. +1 −1 src/providers/db2/qgsdb2expressioncompiler.cpp
  62. +1 −1 src/providers/db2/qgsdb2provider.cpp
  63. +1 −1 src/providers/delimitedtext/qgsdelimitedtextsourceselect.cpp
  64. +5 −5 src/providers/grass/qgsgrass.cpp
  65. +5 −5 src/providers/grass/qgsgrassimport.cpp
  66. +5 −3 src/providers/grass/qgsgrassprovider.cpp
  67. +0 −1 src/providers/grass/qgsgrassprovidermodule.cpp
  68. +1 −1 src/providers/grass/qgsgrassvectormap.cpp
  69. +0 −1 src/providers/mssql/qgsmssqlprovider.cpp
  70. +1 −1 src/providers/ogr/qgsogrdataitems.cpp
  71. +1 −1 src/providers/ogr/qgsogrprovider.cpp
  72. +1 −1 src/providers/ows/qgsowsdataitems.cpp
  73. +1 −2 src/providers/postgres/qgspostgresprovider.cpp
  74. +1 −1 src/providers/spatialite/qgsspatialitefeatureiterator.cpp
  75. +1 −1 src/providers/wfs/qgswfsdatasourceuri.cpp
  76. +11 −11 src/providers/wfs/qgswfsprovider.cpp
  77. +6 −6 src/providers/wfs/qgswfsshareddata.cpp
  78. +1 −1 src/providers/wfs/qgswfsutils.cpp
  79. +1 −2 src/server/qgsconfigcache.cpp
  80. +1 −1 src/server/qgswmsserver.h
  81. +2 −2 tests/bench/main.cpp
  82. +2 −2 tests/src/core/testqgscomposergroup.cpp
  83. +1 −1 tests/src/providers/testqgswcspublicservers.cpp
@@ -108,7 +108,7 @@ class QgsEditorWidgetFactory
* @return A map of widget type names and weight values
* @note not available in Python bindings
*/
//virtual QMap<const char*, int> supportedWidgetTypes() { return QMap<const char*, int>(); }
//virtual QHash<const char*, int> supportedWidgetTypes();

/**
* Create a pretty String representation of the value.
@@ -1126,7 +1126,7 @@ int main( int argc, char *argv[] )
break;
}

coords[i] = QString( myInitialExtent.mid( posOld, pos - posOld ) ).toDouble( &ok );
coords[i] = myInitialExtent.midRef( posOld, pos - posOld ).toDouble( &ok );
if ( !ok )
break;

@@ -1135,7 +1135,7 @@ int main( int argc, char *argv[] )

// parse last coordinate
if ( ok )
coords[3] = QString( myInitialExtent.mid( posOld ) ).toDouble( &ok );
coords[3] = myInitialExtent.midRef( posOld ).toDouble( &ok );

if ( !ok )
{
@@ -84,7 +84,7 @@ void QgsOSMImportDialog::dbFileNameChanged( const QString& fileName )
void QgsOSMImportDialog::onOK()
{
// output file exists?
if ( QFileInfo( editDbFileName->text() ).exists() )
if ( QFileInfo::exists( editDbFileName->text() ) )
{
int res = QMessageBox::question( this, tr( "OpenStreetMap import" ), tr( "Output database file exists already. Overwrite?" ), QMessageBox::Yes | QMessageBox::No );
if ( res != QMessageBox::Yes )
@@ -1240,7 +1240,6 @@ void QgsPluginManager::on_wvDetails_linkClicked( const QUrl & url )
if ( url.host() == "plugin.vote" )
{
QString params = url.path();
QString response;
sendVote( params.split( '/' )[1].toInt(), params.split( '/' )[2].toInt() );
}
}
@@ -1106,8 +1106,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
QgsDebugMsg( "PROFILE TIMES" );
QgsDebugMsg( QString( "PROFILE TIMES TOTAL - %1 " ).arg( mProfiler->totalTime() ) );
#ifdef QGISDEBUG
QList<QPair<QString, double> >::const_iterator it = mProfiler->profileTimes().constBegin();
for ( ; it != mProfiler->profileTimes().constEnd(); ++it )
QList<QPair<QString, double> > profileTimes = mProfiler->profileTimes();
QList<QPair<QString, double> >::const_iterator it = profileTimes.constBegin();
for ( ; it != profileTimes.constEnd(); ++it )
{
QString name = ( *it ).first;
double time = ( *it ).second;
@@ -1765,7 +1766,7 @@ void QgisApp::createActions()
mActionReportaBug->setShortcut( QString() );
#endif

mActionHelpContents->setEnabled( QFileInfo( QgsApplication::pkgDataPath() + "/doc/index.html" ).exists() );
mActionHelpContents->setEnabled( QFileInfo::exists( QgsApplication::pkgDataPath() + "/doc/index.html" ) );

connect( mActionHelpContents, SIGNAL( triggered() ), this, SLOT( helpContents() ) );
connect( mActionHelpAPI, SIGNAL( triggered() ), this, SLOT( apiDocumentation() ) );
@@ -9185,7 +9186,7 @@ void QgisApp::helpContents()

void QgisApp::apiDocumentation()
{
if ( QFileInfo( QgsApplication::pkgDataPath() + "/doc/api/index.html" ).exists() )
if ( QFileInfo::exists( QgsApplication::pkgDataPath() + "/doc/api/index.html" ) )
{
openURL( "api/index.html" );
}
@@ -442,10 +442,10 @@ bool QgsProjectBookmarksTableModel::setData( const QModelIndex& index, const QVa
switch ( index.column() )
{
case 1:
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Name" ).arg( index.row() ), value.value<QString>() );
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Name" ).arg( index.row() ), value.toString() );
return true;
case 2:
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Project" ).arg( index.row() ), value.value<QString>() );
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/Project" ).arg( index.row() ), value.toString() );
return true;
case 3:
QgsProject::instance()->writeEntry( "Bookmarks", QString( "/Row-%1/MinX" ).arg( index.row() ), value.toDouble() );
@@ -674,8 +674,8 @@ void QgsMergedBookmarksTableModel::moveBookmark( QAbstractTableModel& modelFrom,
" VALUES (NULL,:name,:project_name,:xmin,:xmax,:ymin,:ymax,:projection_srid)",
qgisModel->database() );

query.bindValue( ":name", modelFrom.data( modelFrom.index( row, 1 ) ).value<QString>() );
query.bindValue( ":project_name", modelFrom.data( modelFrom.index( row, 2 ) ).value<QString>() );
query.bindValue( ":name", modelFrom.data( modelFrom.index( row, 1 ) ).toString() );
query.bindValue( ":project_name", modelFrom.data( modelFrom.index( row, 2 ) ).toString() );
query.bindValue( ":xmin", modelFrom.data( modelFrom.index( row, 3 ) ).toDouble() );
query.bindValue( ":ymin", modelFrom.data( modelFrom.index( row, 4 ) ).toDouble() );
query.bindValue( ":xmax", modelFrom.data( modelFrom.index( row, 5 ) ).toDouble() );
@@ -257,4 +257,4 @@ void QgsFeatureAction::onFeatureSaved( const QgsFeature& feature )
}
}

QMap<QgsVectorLayer *, QgsAttributeMap> QgsFeatureAction::sLastUsedValues;
QHash<QgsVectorLayer *, QgsAttributeMap> QgsFeatureAction::sLastUsedValues;
@@ -64,7 +64,7 @@ class APP_EXPORT QgsFeatureAction : public QAction

bool mFeatureSaved;

static QMap<QgsVectorLayer *, QgsAttributeMap> sLastUsedValues;
static QHash<QgsVectorLayer *, QgsAttributeMap> sLastUsedValues;
};

#endif
@@ -209,7 +209,7 @@ QString QgsHandleBadLayers::filename( int row )

void QgsHandleBadLayers::setFilename( int row, const QString& filename )
{
if ( !QFileInfo( filename ).exists() )
if ( !QFileInfo::exists( filename ) )
return;

QString type = mLayerList->item( row, 1 )->text();
@@ -105,7 +105,7 @@ void QgsMapToolReshape::cadCanvasReleaseEvent( QgsMapMouseEvent * e )
if ( vlayer->geometryType() == QgsWkbTypes::PolygonGeometry )
{
//ignore all current layer features as they should be reshaped too
QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures;
QHash<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures;
ignoreFeatures.insert( vlayer, vlayer->allFeatureIds() );

if ( geom.avoidIntersections( ignoreFeatures ) != 0 )
@@ -1908,14 +1908,14 @@ void QgsProjectProperties::populateEllipsoidList()
// Crash if no column?
para1 = ( const char * )sqlite3_column_text( myPreparedStatement, 2 );
para2 = ( const char * )sqlite3_column_text( myPreparedStatement, 3 );
myItem.semiMajor = para1.mid( 2 ).toDouble();
myItem.semiMajor = para1.midRef( 2 ).toDouble();
if ( para2.left( 2 ) == "b=" )
{
myItem.semiMinor = para2.mid( 2 ).toDouble();
myItem.semiMinor = para2.midRef( 2 ).toDouble();
}
else if ( para2.left( 3 ) == "rf=" )
{
double invFlattening = para2.mid( 3 ).toDouble();
double invFlattening = para2.midRef( 3 ).toDouble();
if ( invFlattening != 0.0 )
{
myItem.semiMinor = myItem.semiMajor - ( myItem.semiMajor / invFlattening );
@@ -1790,7 +1790,7 @@ bool QgsGeometry::deletePart( int partNum )
return ok;
}

int QgsGeometry::avoidIntersections( const QMap<QgsVectorLayer*, QSet< QgsFeatureId > >& ignoreFeatures )
int QgsGeometry::avoidIntersections( const QHash<QgsVectorLayer *, QSet<QgsFeatureId> > &ignoreFeatures )
{
if ( !d->geometry )
{
@@ -737,7 +737,7 @@ class CORE_EXPORT QgsGeometry
* @param ignoreFeatures possibility to give a list of features where intersections should be ignored (not available in python bindings)
* @note added in 1.5
*/
int avoidIntersections( const QMap<QgsVectorLayer*, QSet<QgsFeatureId> >& ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
int avoidIntersections( const QHash<QgsVectorLayer*, QSet<QgsFeatureId> >& ignoreFeatures = ( QHash<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );

/** \ingroup core
*/
@@ -225,7 +225,7 @@ bool QgsGeometryEditUtils::deletePart( QgsAbstractGeometry* geom, int partNum )
return c->removeGeometry( partNum );
}

QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstractGeometry& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures )
QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstractGeometry& geom, QHash<QgsVectorLayer *, QSet<QgsFeatureId> > ignoreFeatures )
{
QScopedPointer<QgsGeometryEngine> geomEngine( QgsGeometry::createGeometryEngine( &geom ) );
if ( geomEngine.isNull() )
@@ -256,7 +256,7 @@ QgsAbstractGeometry* QgsGeometryEditUtils::avoidIntersections( const QgsAbstract
if ( currentLayer )
{
QgsFeatureIds ignoreIds;
QMap<QgsVectorLayer*, QSet<qint64> >::const_iterator ignoreIt = ignoreFeatures.find( currentLayer );
QHash<QgsVectorLayer*, QSet<qint64> >::const_iterator ignoreIt = ignoreFeatures.find( currentLayer );
if ( ignoreIt != ignoreFeatures.constEnd() )
ignoreIds = ignoreIt.value();

@@ -60,7 +60,7 @@ class QgsGeometryEditUtils
* @param geom geometry to alter
* @param ignoreFeatures map of layer to feature id of features to ignore
*/
static QgsAbstractGeometry* avoidIntersections( const QgsAbstractGeometry& geom, QMap<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures = ( QMap<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
static QgsAbstractGeometry* avoidIntersections( const QgsAbstractGeometry& geom, QHash<QgsVectorLayer*, QSet<QgsFeatureId> > ignoreFeatures = ( QHash<QgsVectorLayer*, QSet<QgsFeatureId> >() ) );
};

#endif // QGSGEOMETRYEDITUTILS_H
@@ -48,7 +48,7 @@ QList< QPair<QString, QString> > QgsGPSDetector::availablePorts()
{
for ( int i = 0; i < 10; ++i )
{
if ( QFileInfo( linuxDev.arg( i ) ).exists() )
if ( QFileInfo::exists( linuxDev.arg( i ) ) )
{
devs << QPair<QString, QString>( linuxDev.arg( i ), linuxDev.arg( i ) );
}
@@ -72,7 +72,7 @@ QgsColorRamp* QgsGradientColorRamp::create( const QgsStringMap& props )
continue;

QColor c = QgsSymbolLayerUtils::decodeColor( stop.mid( i + 1 ) );
stops.append( QgsGradientStop( stop.left( i ).toDouble(), c ) );
stops.append( QgsGradientStop( stop.leftRef( i ).toDouble(), c ) );
}
}

@@ -500,7 +500,7 @@ bool QgsCoordinateReferenceSystem::hasAxisInverted() const
{
OGRSpatialReferenceH crs = OSRNewSpatialReference( nullptr );

if ( OSRImportFromEPSGA( crs, d->mAuthId.mid( 5 ).toInt() ) == OGRERR_NONE )
if ( OSRImportFromEPSGA( crs, d->mAuthId.midRef( 5 ).toInt() ) == OGRERR_NONE )
{
OSRGetAxis( crs, OSRIsGeographic( crs ) ? "GEOGCS" : "PROJCS", 0, &orientation );
}
@@ -1750,7 +1750,7 @@ bool QgsCoordinateReferenceSystem::loadWkts( QHash<int, QString> &wkts, const ch
return false;

bool ok;
int epsg = line.left( pos ).toInt( &ok );
int epsg = line.leftRef( pos ).toInt( &ok );
if ( !ok )
return false;

@@ -1791,7 +1791,7 @@ bool QgsCoordinateReferenceSystem::loadIds( QHash<int, QString> &wkts )
continue;

bool ok;
int epsg = line.left( pos ).toInt( &ok );
int epsg = line.leftRef( pos ).toInt( &ok );
if ( !ok )
continue;

@@ -191,7 +191,7 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )

// get major semiaxis
if ( radius.left( 2 ) == "a=" )
mSemiMajor = radius.mid( 2 ).toDouble();
mSemiMajor = radius.midRef( 2 ).toDouble();
else
{
QgsDebugMsg( QString( "setEllipsoid: wrong format of radius field: '%1'" ).arg( radius ) );
@@ -203,12 +203,12 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )
// second one must be computed using formula: invf = a/(a-b)
if ( parameter2.left( 2 ) == "b=" )
{
mSemiMinor = parameter2.mid( 2 ).toDouble();
mSemiMinor = parameter2.midRef( 2 ).toDouble();
mInvFlattening = mSemiMajor / ( mSemiMajor - mSemiMinor );
}
else if ( parameter2.left( 3 ) == "rf=" )
{
mInvFlattening = parameter2.mid( 3 ).toDouble();
mInvFlattening = parameter2.midRef( 3 ).toDouble();
mSemiMinor = mSemiMajor - ( mSemiMajor / mInvFlattening );
}
else
@@ -3264,7 +3264,7 @@ static QVariant fcnArrayRemoveAll( const QVariantList& values, const QgsExpressi
static QVariant fcnArrayCat( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
{
QVariantList list;
Q_FOREACH ( QVariant cur, values )
Q_FOREACH ( const QVariant& cur, values )
{
list += getListValue( cur, parent );
}
@@ -3274,7 +3274,11 @@ static QVariant fcnArrayCat( const QVariantList& values, const QgsExpressionCont
static QVariant fcnArrayIntersect( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
{
const QVariantList array1 = getListValue( values.at( 0 ), parent );
Q_FOREACH ( QVariant cur, getListValue( values.at( 1 ), parent ) ) if ( array1.contains( cur ) ) return QVariant( true );
Q_FOREACH ( const QVariant& cur, getListValue( values.at( 1 ), parent ) )
{
if ( array1.contains( cur ) )
return QVariant( true );
}
return QVariant( false );
}

@@ -3315,7 +3319,7 @@ static QVariant fcnMapInsert( const QVariantList& values, const QgsExpressionCon
static QVariant fcnMapConcat( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
{
QVariantMap result;
Q_FOREACH ( QVariant cur, values )
Q_FOREACH ( const QVariant& cur, values )
{
const QVariantMap curMap = getMapValue( cur, parent );
for ( QVariantMap::const_iterator it = curMap.constBegin(); it != curMap.constEnd(); ++it )
@@ -387,7 +387,7 @@ QgsGmlStreamingParser::QgsGmlStreamingParser( const QList<LayerProperties>& laye
if ( alreadyFoundGeometry )
{
QgsDebugMsg( QString( "Will ignore geometry field %1 from typename %2" ).
arg( mLayerProperties[i].mGeometryAttribute ).arg( mLayerProperties[i].mName ) );
arg( mLayerProperties[i].mGeometryAttribute, mLayerProperties[i].mName ) );
mLayerProperties[i].mGeometryAttribute.clear();
}
alreadyFoundGeometry = true;
@@ -291,15 +291,15 @@ QVariantList QgsJSONUtils::parseArray( const QString& json, QVariant::Type type
QVariantList result;
if ( error.error != QJsonParseError::NoError )
{
QgsLogger::warning( QString( "Cannot parse json (%1): %2" ).arg( error.errorString() ).arg( json ) );
QgsLogger::warning( QString( "Cannot parse json (%1): %2" ).arg( error.errorString(), json ) );
return result;
}
if ( !jsonDoc.isArray() )
{
QgsLogger::warning( QString( "Cannot parse json (%1) as array: %2" ).arg( error.errorString() ).arg( json ) );
QgsLogger::warning( QString( "Cannot parse json (%1) as array: %2" ).arg( error.errorString(), json ) );
return result;
}
Q_FOREACH ( const QJsonValue cur, jsonDoc.array() )
Q_FOREACH ( const QJsonValue& cur, jsonDoc.array() )
{
QVariant curVariant = cur.toVariant();
if ( curVariant.convert( type ) )
@@ -308,4 +308,4 @@ QVariantList QgsJSONUtils::parseArray( const QString& json, QVariant::Type type
QgsLogger::warning( QString( "Cannot convert json array element: %1" ).arg( cur.toString() ) );
}
return result;
}
}
@@ -2910,7 +2910,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
static QString mapBinarySpatialToOgc( const QString& name )
{
QString nameCompare( name );
if ( name.size() > 3 && name.mid( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
if ( name.size() > 3 && name.midRef( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
nameCompare = name.mid( 3 );
QStringList spatialOps;
spatialOps << "BBOX" << "Intersects" << "Contains" << "Crosses" << "Equals"
@@ -2926,7 +2926,7 @@ static QString mapBinarySpatialToOgc( const QString& name )
static QString mapTernarySpatialToOgc( const QString& name )
{
QString nameCompare( name );
if ( name.size() > 3 && name.mid( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
if ( name.size() > 3 && name.midRef( 0, 3 ).compare( "ST_", Qt::CaseInsensitive ) == 0 )
nameCompare = name.mid( 3 );
if ( nameCompare.compare( "DWithin", Qt::CaseInsensitive ) == 0 )
return "DWithin";
@@ -3293,7 +3293,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
}

QList<QDomElement> listElem;
Q_FOREACH ( QString columnName, node->usingColumns() )
Q_FOREACH ( const QString& columnName, node->usingColumns() )
{
QDomElement eqElem = mDoc.createElement( mFilterPrefix + ":PropertyIsEqualTo" );
QDomElement propElem1 = mDoc.createElement( mFilterPrefix + ":" + mPropertyName );
@@ -3312,7 +3312,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
else if ( listElem.size() > 1 )
{
QDomElement andElem = mDoc.createElement( mFilterPrefix + ":And" );
Q_FOREACH ( QDomElement elem, listElem )
Q_FOREACH ( const QDomElement& elem, listElem )
{
andElem.appendChild( elem );
}
@@ -3356,7 +3356,8 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
}

// Process JOIN conditions
QString leftTable = node->tables().last()->name();
QList< QgsSQLStatement::NodeTableDef*> nodeTables = node->tables();
QString leftTable = nodeTables.at( nodeTables.length() - 1 )->name();
Q_FOREACH ( QgsSQLStatement::NodeJoin* join, node->joins() )
{
QDomElement joinElem = toOgcFilter( join, leftTable );
@@ -3383,7 +3384,7 @@ QDomElement QgsOgcUtilsSQLStatementToFilter::toOgcFilter( const QgsSQLStatement:
else if ( listElem.size() > 1 )
{
QDomElement andElem = mDoc.createElement( mFilterPrefix + ":And" );
Q_FOREACH ( QDomElement elem, listElem )
Q_FOREACH ( const QDomElement& elem, listElem )
{
andElem.appendChild( elem );
}
@@ -231,13 +231,13 @@ bool QgsSQLStatement::doBasicValidationChecks( QString& errorMsgOut ) const
QgsSQLStatementCollectTableNames v;
mRootNode->accept( v );

Q_FOREACH ( QgsSQLStatementCollectTableNames::TableColumnPair pair, v.tableNamesReferenced )
Q_FOREACH ( const QgsSQLStatementCollectTableNames::TableColumnPair& pair, v.tableNamesReferenced )
{
if ( !v.tableNamesDeclared.contains( pair.first ) )
{
if ( !errorMsgOut.isEmpty() )
errorMsgOut += " ";
errorMsgOut += QString( tr( "Table %1 is referenced by column %2, but not selected in FROM / JOIN." ) ).arg( pair.first ).arg( pair.second );
errorMsgOut += QString( tr( "Table %1 is referenced by column %2, but not selected in FROM / JOIN." ) ).arg( pair.first, pair.second );
}
}

0 comments on commit ec25df1

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