QgsProviderMetadata class

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.

Public types

using CreateDataProviderFunction = std::function<QgsDataProvider*(const QString&, const QgsDataProvider::ProviderOptions&)>
Typedef for data provider creation function.

Constructors, destructors, conversion operators

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.

Public functions

auto createFunction() const -> CreateDataProviderFunction
Returns a pointer to the direct provider creation function, if supported by the provider.
auto description() const -> QString
This returns descriptive text for the provider.
auto key() const -> QString
This returns the unique key associated with the provider.
auto library() const -> QString
This returns the library file name.

Typedef documentation

typedef std::function<QgsDataProvider*(const QString&, const QgsDataProvider::ProviderOptions&)> QgsProviderMetadata::CreateDataProviderFunction

Typedef for data provider creation function.

Function documentation

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.

CreateDataProviderFunction QgsProviderMetadata::createFunction() const

Returns a pointer to the direct provider creation function, if supported by the provider.

QString QgsProviderMetadata::description() const

This returns descriptive text for the provider.

This is used to provide a descriptive list of available data providers.

QString QgsProviderMetadata::key() const

This returns the unique key associated with the provider.

This key string is used for the associative container in QgsProviderRegistry

QString QgsProviderMetadata::library() const

This returns the library file name.

This is used to QLibrary calls to load the data provider.