QGIS API Documentation
3.10.0-A Coruña (6c816b4204)
|
Holds data provider key, description, and associated shared library file or function pointer information. More...
#include <qgsprovidermetadata.h>
Public Types | |
typedef std::function< QgsDataProvider *(const QString &, const QgsDataProvider::ProviderOptions &) > | CreateDataProviderFunction |
Typedef for data provider creation function. More... | |
enum | FilterType { FilterType::FilterVector = 1, FilterType::FilterRaster, FilterType::FilterMesh, FilterType::FilterMeshDataset } |
Type of file filters. More... | |
Public Member Functions | |
QgsProviderMetadata (const QString &key, const QString &description, const QString &library=QString()) | |
Constructor for provider metadata. More... | |
Q_DECL_DEPRECATED | QgsProviderMetadata (const QString &key, const QString &description, const QgsProviderMetadata::CreateDataProviderFunction &createFunc) |
Metadata for provider with direct provider creation function pointer, where no library is involved. More... | |
virtual | ~QgsProviderMetadata () |
dtor More... | |
virtual void | cleanupProvider () |
Cleanup the provider. More... | |
virtual QMap< QString, QgsAbstractProviderConnection * > | connections (bool cached=true) SIP_THROW(QgsProviderConnectionException) |
Returns a dictionary of stored provider connections, the dictionary key is the connection identifier. More... | |
template<typename T > | |
QMap< QString, T * > | connections (bool cached=true) |
Returns a dictionary of provider connections of the specified type T, the dictionary key is the connection identifier. More... | |
virtual QgsAbstractProviderConnection * | createConnection (const QString &uri, const QVariantMap &configuration) |
Creates a new connection from uri and configuration, the newly created connection is not automatically stored in the settings, call saveConnection() to save it. More... | |
virtual QgsAbstractProviderConnection * | createConnection (const QString &name) |
Creates a new connection by loading the connection with the given name from the settings. More... | |
virtual bool | createDb (const QString &dbPath, QString &errCause) |
Creates database by the provider on the path. More... | |
virtual QgsVectorLayerExporter::ExportError | createEmptyLayer (const QString &uri, const QgsFields &fields, QgsWkbTypes::Type wkbType, const QgsCoordinateReferenceSystem &srs, bool overwrite, QMap< int, int > &oldToNewAttrIdxMap, QString &errorMessage, const QMap< QString, QVariant > *options) |
Creates new empty vector layer. More... | |
Q_DECL_DEPRECATED CreateDataProviderFunction | createFunction () const |
Returns a pointer to the direct provider creation function, if supported by the provider. More... | |
virtual QgsDataProvider * | createProvider (const QString &uri, const QgsDataProvider::ProviderOptions &options) |
Class factory to return a pointer to a newly created QgsDataProvider object. More... | |
virtual QgsRasterDataProvider * | createRasterDataProvider (const QString &uri, const QString &format, int nBands, Qgis::DataType type, int width, int height, double *geoTransform, const QgsCoordinateReferenceSystem &crs, const QStringList &createOptions=QStringList()) |
Creates a new instance of the raster data provider. More... | |
virtual QgsTransaction * | createTransaction (const QString &connString) |
Returns new instance of transaction. More... | |
virtual QList< QgsDataItemProvider *> | dataItemProviders () const |
Returns data item providers. More... | |
QMap< QString, QgsAbstractDatabaseProviderConnection * > | dbConnections (bool cached=true) SIP_THROW(QgsProviderConnectionException) |
Returns a dictionary of database provider connections, the dictionary key is the connection identifier. More... | |
virtual QVariantMap | decodeUri (const QString &uri) |
Breaks a provider data source URI into its component paths (e.g. More... | |
virtual void | deleteConnection (const QString &name) SIP_THROW(QgsProviderConnectionException) |
Removes the connection with the given name from the settings. More... | |
virtual bool | deleteStyleById (const QString &uri, QString styleId, QString &errCause) |
Deletes a layer style defined by styleId. More... | |
QString | description () const |
This returns descriptive text for the provider. More... | |
virtual QString | filters (FilterType type) |
Builds the list of file filter strings (supported formats) More... | |
QgsAbstractProviderConnection * | findConnection (const QString &name, bool cached=true) SIP_THROW(QgsProviderConnectionException) |
Searches and returns a (possibly NULL) connection from the stored provider connections. More... | |
virtual QString | getStyleById (const QString &uri, QString styleId, QString &errCause) |
Gets a layer style defined by uri. More... | |
virtual void | initProvider () |
Initialize the provider. More... | |
QString | key () const |
This returns the unique key associated with the provider. More... | |
Q_DECL_DEPRECATED QString | library () const |
This returns the library file name. More... | |
virtual int | listStyles (const QString &uri, QStringList &ids, QStringList &names, QStringList &descriptions, QString &errCause) |
Lists stored layer styles in the provider defined by uri. More... | |
virtual QString | loadStyle (const QString &uri, QString &errCause) |
Loads a layer style defined by uri. More... | |
virtual QList< QPair< QString, QString > > | pyramidResamplingMethods () |
Returns pyramid resampling methods available for provider. More... | |
virtual void | saveConnection (const QgsAbstractProviderConnection *connection, const QString &name) |
Stores the connection in the settings. More... | |
virtual bool | saveStyle (const QString &uri, const QString &qmlStyle, const QString &sldStyle, const QString &styleName, const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause) |
Saves a layer style to provider. More... | |
Holds data provider key, description, and associated shared library file or function pointer information.
Provider metadata refers either to providers which are loaded via libraries or which are native providers that are included in the core QGIS installation and accessed through function pointers.
For library based providers, the metadata class is used in a lazy load implementation in QgsProviderRegistry. To save memory, data providers are only actually loaded via QLibrary calls if they're to be used. (Though they're all iteratively loaded once to get their metadata information, and then unloaded when the QgsProviderRegistry is created.) QgsProviderMetadata supplies enough information to be able to later load the associated shared library object.
Definition at line 64 of file qgsprovidermetadata.h.
typedef std::function< QgsDataProvider*( const QString &, const QgsDataProvider::ProviderOptions & ) > QgsProviderMetadata::CreateDataProviderFunction |
Typedef for data provider creation function.
Definition at line 72 of file qgsprovidermetadata.h.
|
strong |
Type of file filters.
Enumerator | |
---|---|
FilterVector | |
FilterRaster | |
FilterMesh | |
FilterMeshDataset |
Definition at line 141 of file qgsprovidermetadata.h.
QgsProviderMetadata::QgsProviderMetadata | ( | const QString & | key, |
const QString & | description, | ||
const QString & | library = QString() |
||
) |
Constructor for provider metadata.
key | provider key |
description | provider description |
library | plugin library file name (empty if the provider is not loaded from a library) |
Definition at line 24 of file qgsprovidermetadata.cpp.
QgsProviderMetadata::QgsProviderMetadata | ( | const QString & | key, |
const QString & | description, | ||
const QgsProviderMetadata::CreateDataProviderFunction & | createFunc | ||
) |
Metadata for provider with direct provider creation function pointer, where no library is involved.
Definition at line 32 of file qgsprovidermetadata.cpp.
|
virtual |
dtor
Definition at line 38 of file qgsprovidermetadata.cpp.
|
virtual |
|
virtual |
Returns a dictionary of stored provider connections, the dictionary key is the connection identifier.
Ownership is not transferred. Raises a QgsProviderConnectionException if any errors are encountered.
cached | if false connections will be re-read from the settings |
QgsProviderConnectionException |
Definition at line 165 of file qgsprovidermetadata.cpp.
QMap< QString, T * > QgsProviderMetadata::connections | ( | bool | cached = true | ) |
Returns a dictionary of provider connections of the specified type T, the dictionary key is the connection identifier.
cached | if false connections will be re-read from the settings |
Definition at line 226 of file qgsprovidermetadata.cpp.
|
virtual |
Creates a new connection from uri and configuration, the newly created connection is not automatically stored in the settings, call saveConnection() to save it.
Ownership is transferred to the caller.
Definition at line 197 of file qgsprovidermetadata.cpp.
|
virtual |
Creates a new connection by loading the connection with the given name from the settings.
Ownership is transferred to the caller.
Definition at line 190 of file qgsprovidermetadata.cpp.
|
virtual |
Creates database by the provider on the path.
Definition at line 154 of file qgsprovidermetadata.cpp.
|
virtual |
Creates new empty vector layer.
Definition at line 92 of file qgsprovidermetadata.cpp.
QgsProviderMetadata::CreateDataProviderFunction QgsProviderMetadata::createFunction | ( | ) | const |
Returns a pointer to the direct provider creation function, if supported by the provider.
Definition at line 58 of file qgsprovidermetadata.cpp.
|
virtual |
Class factory to return a pointer to a newly created QgsDataProvider object.
Definition at line 78 of file qgsprovidermetadata.cpp.
|
virtual |
Creates a new instance of the raster data provider.
Definition at line 102 of file qgsprovidermetadata.cpp.
|
virtual |
Returns new instance of transaction.
Ownership is transferred to the caller
Definition at line 160 of file qgsprovidermetadata.cpp.
|
virtual |
Returns data item providers.
Caller is responsible for ownership of the item providers
Definition at line 117 of file qgsprovidermetadata.cpp.
QMap< QString, QgsAbstractDatabaseProviderConnection * > QgsProviderMetadata::dbConnections | ( | bool | cached = true | ) |
Returns a dictionary of database provider connections, the dictionary key is the connection identifier.
Ownership is not transferred. Raises a QgsProviderConnectionException if any errors are encountered.
cached | if false connections will be re-read from the settings |
QgsProviderConnectionException |
Definition at line 171 of file qgsprovidermetadata.cpp.
|
virtual |
Breaks a provider data source URI into its component paths (e.g.
file path, layer name).
uri | uri string |
Definition at line 87 of file qgsprovidermetadata.cpp.
|
virtual |
Removes the connection with the given name from the settings.
Raises a QgsProviderConnectionException if any errors are encountered.
QgsProviderConnectionException |
Definition at line 204 of file qgsprovidermetadata.cpp.
|
virtual |
Deletes a layer style defined by styleId.
Definition at line 135 of file qgsprovidermetadata.cpp.
QString QgsProviderMetadata::description | ( | ) | const |
This returns descriptive text for the provider.
This is used to provide a descriptive list of available data providers.
Definition at line 48 of file qgsprovidermetadata.cpp.
|
virtual |
Builds the list of file filter strings (supported formats)
Suitable for use in a QFileDialog::getOpenFileNames() call.
Definition at line 73 of file qgsprovidermetadata.cpp.
QgsAbstractProviderConnection * QgsProviderMetadata::findConnection | ( | const QString & | name, |
bool | cached = true |
||
) |
Searches and returns a (possibly NULL) connection from the stored provider connections.
Ownership is not transferred. Raises a QgsProviderConnectionException if any errors are encountered.
name | the connection name |
cached | if false connections will be re-read from the settings |
QgsProviderConnectionException |
Definition at line 176 of file qgsprovidermetadata.cpp.
|
virtual |
Gets a layer style defined by uri.
Definition at line 129 of file qgsprovidermetadata.cpp.
|
virtual |
QString QgsProviderMetadata::key | ( | ) | const |
This returns the unique key associated with the provider.
This key string is used for the associative container in QgsProviderRegistry
Definition at line 43 of file qgsprovidermetadata.cpp.
QString QgsProviderMetadata::library | ( | ) | const |
This returns the library file name.
This is used to QLibrary calls to load the data provider (only for dynamically loaded libraries)
Definition at line 53 of file qgsprovidermetadata.cpp.
|
virtual |
Lists stored layer styles in the provider defined by uri.
Definition at line 122 of file qgsprovidermetadata.cpp.
|
virtual |
Loads a layer style defined by uri.
Definition at line 148 of file qgsprovidermetadata.cpp.
|
virtual |
Returns pyramid resampling methods available for provider.
Definition at line 112 of file qgsprovidermetadata.cpp.
|
virtual |
Stores the connection in the settings.
connection | the connection to be stored in the settings |
name | the name under which the connection will be stored |
Definition at line 210 of file qgsprovidermetadata.cpp.
|
virtual |
Saves a layer style to provider.
Definition at line 141 of file qgsprovidermetadata.cpp.