Skip to content
Permalink
Browse files

Mark some QgsProviderMetadata methods as const

  • Loading branch information
nyalldawson committed Nov 5, 2020
1 parent cad2884 commit 7717a20af727436cebabc63f54c302c3428c045a
Showing with 63 additions and 63 deletions.
  1. +3 −3 python/core/auto_generated/qgsprovidermetadata.sip.in
  2. +3 −3 src/core/providers/ept/qgseptprovider.cpp
  3. +3 −3 src/core/providers/ept/qgseptprovider.h
  4. +2 −2 src/core/providers/gdal/qgsgdalprovider.cpp
  5. +2 −2 src/core/providers/gdal/qgsgdalprovider.h
  6. +2 −2 src/core/providers/ogr/qgsogrprovider.cpp
  7. +2 −2 src/core/providers/ogr/qgsogrprovider.h
  8. +3 −3 src/core/qgsprovidermetadata.cpp
  9. +3 −3 src/core/qgsprovidermetadata.h
  10. +2 −2 src/providers/arcgisrest/qgsafsprovider.cpp
  11. +2 −2 src/providers/arcgisrest/qgsafsprovider.h
  12. +2 −2 src/providers/arcgisrest/qgsamsprovider.cpp
  13. +2 −2 src/providers/arcgisrest/qgsamsprovider.h
  14. +2 −2 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  15. +2 −2 src/providers/delimitedtext/qgsdelimitedtextprovider.h
  16. +2 −2 src/providers/mdal/qgsmdalprovider.cpp
  17. +2 −2 src/providers/mdal/qgsmdalprovider.h
  18. +2 −2 src/providers/mssql/qgsmssqlprovider.cpp
  19. +2 −2 src/providers/mssql/qgsmssqlprovider.h
  20. +2 −2 src/providers/pdal/qgspdalprovider.cpp
  21. +2 −2 src/providers/pdal/qgspdalprovider.h
  22. +2 −2 src/providers/postgres/qgspostgresprovider.cpp
  23. +2 −2 src/providers/postgres/qgspostgresprovider.h
  24. +2 −2 src/providers/postgres/raster/qgspostgresrasterprovider.cpp
  25. +2 −2 src/providers/postgres/raster/qgspostgresrasterprovider.h
  26. +2 −2 src/providers/spatialite/qgsspatialiteprovider.cpp
  27. +2 −2 src/providers/spatialite/qgsspatialiteprovider.h
  28. +2 −2 src/providers/wms/qgswmsprovider.cpp
  29. +2 −2 src/providers/wms/qgswmsprovider.h
@@ -184,7 +184,7 @@ Builds the list of available mesh drivers metadata
.. versionadded:: 3.12
%End

virtual int priorityForUri( const QString &uri );
virtual int priorityForUri( const QString &uri ) const;
%Docstring
Returns an integer representing the priority which this provider should have when opening
a dataset with the specified ``uri``.
@@ -262,7 +262,7 @@ Returns pyramid resampling methods available for provider
.. versionadded:: 3.10
%End

virtual QVariantMap decodeUri( const QString &uri );
virtual QVariantMap decodeUri( const QString &uri ) const;
%Docstring
Breaks a provider data source URI into its component paths (e.g. file path, layer name).

@@ -286,7 +286,7 @@ Breaks a provider data source URI into its component paths (e.g. file path, laye
.. versionadded:: 3.10
%End

virtual QString encodeUri( const QVariantMap &parts );
virtual QString encodeUri( const QVariantMap &parts ) const;
%Docstring
Reassembles a provider data source URI from its component paths (e.g. file path, layer name).

@@ -90,7 +90,7 @@ QList<QgsDataItemProvider *> QgsEptProviderMetadata::dataItemProviders() const
return providers;
}

int QgsEptProviderMetadata::priorityForUri( const QString &uri )
int QgsEptProviderMetadata::priorityForUri( const QString &uri ) const
{
const QVariantMap parts = decodeUri( uri );
QFileInfo fi( parts.value( QStringLiteral( "path" ) ).toString() );
@@ -100,7 +100,7 @@ int QgsEptProviderMetadata::priorityForUri( const QString &uri )
return 0;
}

QVariantMap QgsEptProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsEptProviderMetadata::decodeUri( const QString &uri ) const
{
const QString path = uri;
QVariantMap uriComponents;
@@ -124,7 +124,7 @@ QString QgsEptProviderMetadata::filters( QgsProviderMetadata::FilterType type )
return QString();
}

QString QgsEptProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsEptProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
const QString path = parts.value( QStringLiteral( "path" ) ).toString();
return path;
@@ -63,9 +63,9 @@ class QgsEptProviderMetadata : public QgsProviderMetadata
QgsEptProviderMetadata();
QgsEptProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QList< QgsDataItemProvider * > dataItemProviders() const override;
int priorityForUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) override;
int priorityForUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
QVariantMap decodeUri( const QString &uri ) const override;
QString filters( FilterType type ) override;
};

@@ -2319,7 +2319,7 @@ QStringList QgsGdalProvider::subLayers() const
return mSubLayers;
}

QVariantMap QgsGdalProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsGdalProviderMetadata::decodeUri( const QString &uri ) const
{
QString path = uri;
QString layerName;
@@ -2350,7 +2350,7 @@ QVariantMap QgsGdalProviderMetadata::decodeUri( const QString &uri )
return uriComponents;
}

QString QgsGdalProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsGdalProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
QString path = parts.value( QStringLiteral( "path" ) ).toString();
QString layerName = parts.value( QStringLiteral( "layerName" ) ).toString();
@@ -365,8 +365,8 @@ class QgsGdalProviderMetadata final: public QgsProviderMetadata
{
public:
QgsGdalProviderMetadata();
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
QgsGdalProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QgsGdalProvider *createRasterDataProvider(
const QString &uri,
@@ -3559,7 +3559,7 @@ QString createFilters( const QString &type )
}
}

QVariantMap QgsOgrProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsOgrProviderMetadata::decodeUri( const QString &uri ) const
{
QString path = uri;
QString layerName;
@@ -3668,7 +3668,7 @@ QVariantMap QgsOgrProviderMetadata::decodeUri( const QString &uri )
return uriComponents;
}

QString QgsOgrProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsOgrProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
const QString path = parts.value( QStringLiteral( "path" ) ).toString();
const QString layerName = parts.value( QStringLiteral( "layerName" ) ).toString();
@@ -751,8 +751,8 @@ class QgsOgrProviderMetadata final: public QgsProviderMetadata
void cleanupProvider() override;
QList< QgsDataItemProvider * > dataItemProviders() const override;
QgsOgrProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
QString filters( FilterType type ) override;
QgsVectorLayerExporter::ExportError createEmptyLayer(
const QString &uri,
@@ -81,7 +81,7 @@ QList<QgsMeshDriverMetadata> QgsProviderMetadata::meshDriversMetadata()
return QList<QgsMeshDriverMetadata>();
}

int QgsProviderMetadata::priorityForUri( const QString & )
int QgsProviderMetadata::priorityForUri( const QString & ) const
{
return 0;
}
@@ -131,12 +131,12 @@ bool QgsProviderMetadata::boolParameter( const QVariantMap &uri, const QString &
return defaultValue;
}

QVariantMap QgsProviderMetadata::decodeUri( const QString & )
QVariantMap QgsProviderMetadata::decodeUri( const QString & ) const
{
return QVariantMap();
}

QString QgsProviderMetadata::encodeUri( const QVariantMap & )
QString QgsProviderMetadata::encodeUri( const QVariantMap & ) const
{
return QString();
}
@@ -250,7 +250,7 @@ class CORE_EXPORT QgsProviderMetadata : public QObject
*
* \since QGIS 3.18
*/
virtual int priorityForUri( const QString &uri );
virtual int priorityForUri( const QString &uri ) const;

/**
* Class factory to return a pointer to a newly created QgsDataProvider object
@@ -347,7 +347,7 @@ class CORE_EXPORT QgsProviderMetadata : public QObject
* \note this function may not be supported by all providers, an empty map will be returned in such case
* \since QGIS 3.10
*/
virtual QVariantMap decodeUri( const QString &uri );
virtual QVariantMap decodeUri( const QString &uri ) const;

/**
* Reassembles a provider data source URI from its component paths (e.g. file path, layer name).
@@ -357,7 +357,7 @@ class CORE_EXPORT QgsProviderMetadata : public QObject
* \see decodeUri()
* \since QGIS 3.12
*/
virtual QString encodeUri( const QVariantMap &parts );
virtual QString encodeUri( const QVariantMap &parts ) const;

/**
* Returns data item providers. Caller is responsible for ownership of the item providers
@@ -400,7 +400,7 @@ QList<QgsDataItemProvider *> QgsAfsProviderMetadata::dataItemProviders() const
return providers;
}

QVariantMap QgsAfsProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsAfsProviderMetadata::decodeUri( const QString &uri ) const
{
QgsDataSourceUri dsUri = QgsDataSourceUri( uri );

@@ -436,7 +436,7 @@ QVariantMap QgsAfsProviderMetadata::decodeUri( const QString &uri )
return components;
}

QString QgsAfsProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsAfsProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
QgsDataSourceUri dsUri;
dsUri.setParam( QStringLiteral( "url" ), parts.value( QStringLiteral( "url" ) ).toString() );
@@ -100,8 +100,8 @@ class QgsAfsProviderMetadata: public QgsProviderMetadata
public:
QgsAfsProviderMetadata();
QList<QgsDataItemProvider *> dataItemProviders() const override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
QgsAfsProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;

};
@@ -1258,7 +1258,7 @@ QgsAmsProvider *QgsAmsProviderMetadata::createProvider( const QString &uri, cons
return new QgsAmsProvider( uri, options, flags );
}

QVariantMap QgsAmsProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsAmsProviderMetadata::decodeUri( const QString &uri ) const
{
QgsDataSourceUri dsUri = QgsDataSourceUri( uri );

@@ -1267,7 +1267,7 @@ QVariantMap QgsAmsProviderMetadata::decodeUri( const QString &uri )
return components;
}

QString QgsAmsProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsAmsProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
QgsDataSourceUri dsUri;
dsUri.setParam( QStringLiteral( "url" ), parts.value( QStringLiteral( "url" ) ).toString() );
@@ -222,8 +222,8 @@ class QgsAmsProviderMetadata: public QgsProviderMetadata
QgsAmsProviderMetadata();
QList<QgsDataItemProvider *> dataItemProviders() const override;
QgsAmsProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
};

#endif // QGSMAPSERVERPROVIDER_H
@@ -1260,14 +1260,14 @@ QString QgsDelimitedTextProvider::description() const
return TEXT_PROVIDER_DESCRIPTION;
}

QVariantMap QgsDelimitedTextProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsDelimitedTextProviderMetadata::decodeUri( const QString &uri ) const
{
QVariantMap components;
components.insert( QStringLiteral( "path" ), QUrl( uri ).toLocalFile() );
return components;
}

QString QgsDelimitedTextProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsDelimitedTextProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
return QStringLiteral( "file://%1" ).arg( parts.value( QStringLiteral( "path" ) ).toString() );
}
@@ -238,8 +238,8 @@ class QgsDelimitedTextProviderMetadata final: public QgsProviderMetadata
public:
QgsDelimitedTextProviderMetadata();
QgsDataProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
};

#endif
@@ -967,15 +967,15 @@ bool QgsMdalProviderMetadata::createMeshData( const QgsMesh &mesh, const QString
return true;
}

QVariantMap QgsMdalProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsMdalProviderMetadata::decodeUri( const QString &uri ) const
{
const QString path = uri;
QVariantMap uriComponents;
uriComponents.insert( QStringLiteral( "path" ), path );
return uriComponents;
}

QString QgsMdalProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsMdalProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
const QString path = parts.value( QStringLiteral( "path" ) ).toString();
return path;
@@ -143,8 +143,8 @@ class QgsMdalProviderMetadata: public QgsProviderMetadata
const QString uri,
const QString &driverName,
const QgsCoordinateReferenceSystem &crs ) const override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
};

#endif //QGSMDALPROVIDER_H
@@ -2651,7 +2651,7 @@ QString QgsMssqlProviderMetadata::getStyleById( const QString &uri, QString styl
return style;
}

QVariantMap QgsMssqlProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsMssqlProviderMetadata::decodeUri( const QString &uri ) const
{
const QgsDataSourceUri dsUri { uri };
QVariantMap uriParts;
@@ -2720,7 +2720,7 @@ QVariantMap QgsMssqlProviderMetadata::decodeUri( const QString &uri )
return uriParts;
}

QString QgsMssqlProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsMssqlProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
QgsDataSourceUri dsUri;
if ( parts.contains( QStringLiteral( "dbname" ) ) )
@@ -314,8 +314,8 @@ class QgsMssqlProviderMetadata final: public QgsProviderMetadata
void saveConnection( const QgsAbstractProviderConnection *createConnection, const QString &name ) override;

// Data source URI API
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;

};

@@ -128,7 +128,7 @@ QList<QgsDataItemProvider *> QgsPdalProviderMetadata::dataItemProviders() const
return providers;
}

QVariantMap QgsPdalProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsPdalProviderMetadata::decodeUri( const QString &uri ) const
{
const QString path = uri;
QVariantMap uriComponents;
@@ -153,7 +153,7 @@ QString QgsPdalProviderMetadata::filters( QgsProviderMetadata::FilterType type )
return QString();
}

QString QgsPdalProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsPdalProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
const QString path = parts.value( QStringLiteral( "path" ) ).toString();
return path;
@@ -58,8 +58,8 @@ class QgsPdalProviderMetadata : public QgsProviderMetadata
QgsPdalProviderMetadata();
QgsPdalProvider *createProvider( const QString &uri, const QgsDataProvider::ProviderOptions &options, QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() ) override;
QList< QgsDataItemProvider * > dataItemProviders() const override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) const override;
QVariantMap decodeUri( const QString &uri ) const override;
QString filters( FilterType type ) override;
};

@@ -5710,7 +5710,7 @@ QGISEXTERN QgsProviderMetadata *providerMetadataFactory()
#endif


QVariantMap QgsPostgresProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsPostgresProviderMetadata::decodeUri( const QString &uri ) const
{
const QgsDataSourceUri dsUri { uri };
QVariantMap uriParts;
@@ -5759,7 +5759,7 @@ QVariantMap QgsPostgresProviderMetadata::decodeUri( const QString &uri )
}


QString QgsPostgresProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsPostgresProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
QgsDataSourceUri dsUri;
if ( parts.contains( QStringLiteral( "dbname" ) ) )
@@ -596,8 +596,8 @@ class QgsPostgresProviderMetadata final: public QgsProviderMetadata
void saveConnection( const QgsAbstractProviderConnection *createConnection, const QString &name ) override;
void initProvider() override;
void cleanupProvider() override;
QVariantMap decodeUri( const QString &uri ) override;
QString encodeUri( const QVariantMap &parts ) override;
QVariantMap decodeUri( const QString &uri ) const override;
QString encodeUri( const QVariantMap &parts ) const override;
};

// clazy:excludeall=qstring-allocations
@@ -539,7 +539,7 @@ QgsPostgresRasterProviderMetadata::QgsPostgresRasterProviderMetadata()

}

QVariantMap QgsPostgresRasterProviderMetadata::decodeUri( const QString &uri )
QVariantMap QgsPostgresRasterProviderMetadata::decodeUri( const QString &uri ) const
{
const QgsDataSourceUri dsUri { uri };
QVariantMap decoded;
@@ -625,7 +625,7 @@ QVariantMap QgsPostgresRasterProviderMetadata::decodeUri( const QString &uri )
}


QString QgsPostgresRasterProviderMetadata::encodeUri( const QVariantMap &parts )
QString QgsPostgresRasterProviderMetadata::encodeUri( const QVariantMap &parts ) const
{
QgsDataSourceUri dsUri;
if ( parts.contains( QStringLiteral( "dbname" ) ) )

0 comments on commit 7717a20

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