19#ifndef QGSPROVIDERREGISTRY_H
20#define QGSPROVIDERREGISTRY_H
32using namespace Qt::StringLiterals;
59class CORE_EXPORT QgsProviderRegistry
106 Q_DECL_DEPRECATED QString library(
const QString &providerKey )
const SIP_DEPRECATED;
109 QString pluginList(
bool asHtml =
false )
const;
114 QDir libraryDirectory()
const;
117 void setLibraryDirectory(
const QDir &path );
147 const QString &dataSource,
156 Q_DECL_DEPRECATED
Qgis::DataItemProviderCapabilities providerCapabilities( const QString &providerKey ) const
SIP_DEPRECATED;
163 SIP_SKIP Qgis::VectorExportResult createEmptyLayer( const QString &providerKey, const QString &uri, const
QgsFields &fields,
Qgis::WkbType wkbType, const
QgsCoordinateReferenceSystem &srs,
bool overwrite, QMap<
int,
int> &oldToNewAttrIdxMap, QString &errorMessage, const QMap<QString, QVariant> *options, QString &createdLayerName );
174 const QString &providerKey,
176 const QString &format,
179 int width,
int height,
180 double *geoTransform,
182 const QStringList &createOptions = QStringList() )
SIP_FACTORY;
189 QList<QPair<QString, QString> > pyramidResamplingMethods( const QString &providerKey );
199 QVariantMap decodeUri( const QString &providerKey, const QString &uri );
210 QString encodeUri( const QString &providerKey, const QVariantMap &parts );
223 QString absoluteToRelativeUri( const QString &providerKey, const QString &uri, const
QgsReadWriteContext &context ) const;
236 QString relativeToAbsoluteUri( const QString &providerKey, const QString &uri, const
QgsReadWriteContext &context ) const;
258 int listStyles( const QString &providerKey,
262 QStringList &descriptions,
277 bool styleExists( const QString &providerKey, const QString &uri, const QString &styleId, QString &errorCause
SIP_OUT );
286 QString getStyleById( const QString &providerKey, const QString &uri, const QString &styleId, QString &errCause );
292 bool deleteStyleById( const QString &providerKey, const QString &uri, const QString &styleId, QString &errCause );
299 bool saveStyle( const QString &providerKey, const QString &uri, const QString &qmlStyle, const QString &sldStyle,
300 const QString &styleName, const QString &styleDescription,
301 const QString &uiFileContent,
bool useAsDefault, QString &errCause );
308 QString loadStyle( const QString &providerKey, const QString &uri, QString &errCause );
319 QString loadStoredStyle( const QString &providerKey, const QString &uri, QString &styleName, QString &errCause );
342 bool createDb( const QString &providerKey, const QString &dbPath, QString &errCause );
360 Q_DECL_DEPRECATED QFunctionPointer function( const QString &providerKey, const QString &functionName ) const
SIP_DEPRECATED;
374 QStringList providerList() const;
385 QSet< QString > providersForLayerType(
Qgis::LayerType type ) const;
416 QList<Qgis::LayerType>
layerTypes()
const {
return mLayerTypes; }
419 SIP_PYOBJECT __repr__();
421 QString str = u
"<QgsProviderRegistry.ProviderCandidateDetails: %1>"_s.arg( sipCpp->metadata()->key() );
422 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
429 QList< Qgis::LayerType > mLayerTypes;
449 QList< QgsProviderRegistry::ProviderCandidateDetails > preferredProvidersForUri(
const QString &uri )
const;
500 SIP_PYOBJECT __repr__();
502 QString str = u
"<QgsProviderRegistry.UnusableUriDetails: %1>"_s.arg( sipCpp->warning );
503 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
755 QgsProviderRegistry(
const QString &pluginPath );
758 QgsProviderRegistry(
const QString &pluginPath );
768 QDir mLibraryDirectory;
770 void rebuildFilterStrings();
781 QString mVectorFileFilters;
786 QString mRasterFileFilters;
791 QString mMeshFileFilters;
796 QString mMeshDatasetFileFilters;
801 QString mPointCloudFileFilters;
806 QString mVectorTileFileFilters;
811 QString mTiledSceneFileFilters;
819 QString mDatabaseDrivers;
826 QString mDirectoryDrivers;
834 QString mProtocolDrivers;
836 QList< UnusableUriHandlerInterface * > mUnusableUriHandlers;
841 static bool exists();
Provides global constants and enumerations for use throughout the application.
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
QFlags< SublayerQueryFlag > SublayerQueryFlags
Sublayer query flags.
Represents a coordinate reference system (CRS).
Interface for providers that add custom data items to the browser tree.
Base class for all items in the model.
Abstract base class for spatial data provider implementations.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Container of fields for a vector layer.
Custom exception class which is raised when an operation is not supported.
QList< Qgis::LayerType > layerTypes() const
Returns a list of map layer types which are valid options for opening the target using this candidate...
QgsProviderMetadata * metadata() const
Returns the candidate provider metadata.
ProviderCandidateDetails(QgsProviderMetadata *metadata, const QList< Qgis::LayerType > &layerTypes)
Constructor for ProviderCandidateDetails, with the specified provider metadata and valid candidate la...
Contains information about unusable URIs which aren't handled by any registered providers.
QString warning
Contains a short, user-friendly, translated message advising why the URI is not usable.
QString uri
URI which could not be handled.
QString detailedWarning
Contains a longer, user-friendly, translated message advising why the URI is not usable.
UnusableUriDetails(const QString &uri=QString(), const QString &warning=QString(), const QList< Qgis::LayerType > &layerTypes=QList< Qgis::LayerType >())
Constructor for UnusableUriDetails for the given uri, with the specified user-friendly,...
QList< Qgis::LayerType > layerTypes
Contains a list of map layer types which are usually valid options for opening the target URI.
An interface used to handle unusable URIs which aren't handled by any registered providers,...
virtual ~UnusableUriHandlerInterface()=default
virtual UnusableUriDetails details(const QString &uri) const =0
Returns the details for advising the user why the uri is not usable.
virtual bool matchesUri(const QString &uri) const =0
Returns true if the handle is an unusable URI handler for the specified uri.
A registry / canonical manager of data providers.
std::map< QString, QgsProviderMetadata * > Providers
Type for data provider metadata associative container.
QString fileVectorTileFilters() const
Returns a file filter string for supported vector tile files.
QList< QgsProviderSublayerDetails > querySublayers(const QString &uri, Qgis::SublayerQueryFlags flags=Qgis::SublayerQueryFlags(), QgsFeedback *feedback=nullptr) const
Queries the specified uri and returns a list of any valid sublayers found in the dataset which can be...
Q_DECL_DEPRECATED void registerGuis(QWidget *widget)
WidgetMode
Different ways a source select dialog can be used.
@ Standalone
Basic mode when the widget is used as a standalone dialog.
@ Embedded
Used for the data source manager dialog where the widget is embedded as the main content for a partic...
@ Manager
Used by data items for QgsDataItem::paramWidget().
QString protocolDrivers() const
Returns a string containing the available protocol drivers.
friend class QgsApplication
QString fileTiledSceneFilters() const
Returns a file filter string for supported tiled scene files.
QString databaseDrivers() const
Returns a string containing the available database drivers.
bool uriIsBlocklisted(const QString &uri) const
Returns true if the specified uri is known by any registered provider to be something which should be...
bool handleUnusableUri(const QString &uri, UnusableUriDetails &details) const
Returns true if the specified uri can potentially be handled by QGIS, if additional dependencies or b...
QString fileVectorFilters() const
Returns a file filter string for supported vector files.
QString fileRasterFilters() const
Returns a file filter string for supported raster files.
QString fileMeshFilters() const
Returns a file filter string for supported mesh files.
bool shouldDeferUriForOtherProviders(const QString &uri, const QString &providerKey) const
Returns true if the provider with matching providerKey should defer handling of the specified uri to ...
QString fileMeshDatasetFilters() const
Returns a file filter string for supported mesh dataset files.
QgsProviderMetadata * providerMetadata(const QString &providerKey) const
Returns metadata of the provider or nullptr if not found.
bool registerProvider(QgsProviderMetadata *providerMetadata)
register a new vector data provider from its providerMetadata
QString directoryDrivers() const
Returns a string containing the available directory drivers.
bool registerUnusableUriHandler(UnusableUriHandlerInterface *handler)
Registers an unusable URI handler, used to handle unusable URIs which aren't handled by any registere...
QString filePointCloudFilters() const
Returns a file filter string for supported point clouds.
Contains details about a sub layer available from a dataset.
Base class for raster data providers.
A container for the context for various read/write operations on objects.
Allows creation of a multi-layer database-side transaction.
Represents a vector layer which manages a vector based dataset.
#define SIP_THROW(name,...)
Setting options for creating vector data providers.