QGIS API Documentation  2.10.1-Pisa
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsProviderRegistry Class Reference

A registry / canonical manager of data providers. More...

#include <qgsproviderregistry.h>

Public Types

typedef std::map< QString,
QgsProviderMetadata * > 
Providers
 open the given vector data source More...
 

Public Member Functions

virtual ~QgsProviderRegistry ()
 Virtual dectructor. More...
 
virtual QString databaseDrivers () const
 return a string containing the available database drivers More...
 
virtual QString directoryDrivers () const
 return a string containing the available directory drivers More...
 
virtual QString fileRasterFilters () const
 return raster file filter string More...
 
virtual QString fileVectorFilters () const
 return vector file filter string More...
 
void * function (const QString &providerKey, const QString &functionName)
 Get pointer to provider function. More...
 
QString library (const QString &providerKey) const
 Return path for the library of the provider. More...
 
const QDirlibraryDirectory () const
 return library directory where plugins are found More...
 
QString pluginList (bool asHtml=false) const
 Return list of provider plugins found. More...
 
virtual QString protocolDrivers () const
 return a string containing the available protocol drivers More...
 
QgsDataProviderprovider (const QString &providerKey, const QString &dataSource)
 Create an instance of the provider. More...
 
int providerCapabilities (const QString &providerKey) const
 Return the provider capabilities. More...
 
QLibraryproviderLibrary (const QString &providerKey) const
 
QStringList providerList () const
 Return list of available providers by their keys. More...
 
const QgsProviderMetadataproviderMetadata (const QString &providerKey) const
 Return metadata of the provider or NULL if not found. More...
 
void registerGuis (QWidget *widget)
 
QWidgetselectWidget (const QString &providerKey, QWidget *parent=0, Qt::WindowFlags fl=0)
 
void setLibraryDirectory (const QDir &path)
 Set library directory where to search for plugins. More...
 

Static Public Member Functions

static QgsProviderRegistryinstance (QString pluginPath=QString::null)
 means of accessing canonical single instance More...
 

Detailed Description

A registry / canonical manager of data providers.

This is a Singleton class that manages data provider access.

Loaded providers may be restricted using QGIS_PROVIDER_FILE environment variable. QGIS_PROVIDER_FILE is regexp pattern applied to provider file name (not provider key). For example, if the variable is set to gdal|ogr|postgres it will load only providers gdal, ogr and postgres.

Definition at line 45 of file qgsproviderregistry.h.

Member Typedef Documentation

open the given vector data source

Similar to open(QString const &), except that the user specifies a data provider with which to open the data source instead of using the default data provider that QgsDataManager would figure out to use. This should be useful when (and if) there will exist more than one data provider that can handle a given data source. (E.g., use GDAL to open an SDTS file, or a different data provider that uses sdts++.)

Called by QgsDataManager::open().

Parameters
namecould be a file, URI
provideris the key for the dataprovider used to open name
Returns
NULL if unable to open vector data source

Temporarily always returns false until finished implementing.

Eventually would be nice if could make QgsDataManager smart enough to figure out whether the given name mapped to a vector, raster, or database source.type for data provider metadata associative container

Definition at line 169 of file qgsproviderregistry.h.

Constructor & Destructor Documentation

QgsProviderRegistry::~QgsProviderRegistry ( )
virtual

Virtual dectructor.

Definition at line 223 of file qgsproviderregistry.cpp.

Member Function Documentation

QString QgsProviderRegistry::databaseDrivers ( ) const
virtual

return a string containing the available database drivers

Definition at line 505 of file qgsproviderregistry.cpp.

QString QgsProviderRegistry::directoryDrivers ( ) const
virtual

return a string containing the available directory drivers

Definition at line 510 of file qgsproviderregistry.cpp.

QString QgsProviderRegistry::fileRasterFilters ( ) const
virtual

return raster file filter string

Returns a string suitable for a QFileDialog of raster file formats supported by all data providers.

This walks through all data providers appending calls to their buildSupportedRasterFileFilter to a string, which is then returned.

Note
This replaces QgsRasterLayer::buildSupportedRasterFileFilter()

Definition at line 500 of file qgsproviderregistry.cpp.

QString QgsProviderRegistry::fileVectorFilters ( ) const
virtual

return vector file filter string

Returns a string suitable for a QFileDialog of vector file formats supported by all data providers.

This walks through all data providers appending calls to their fileVectorFilters to a string, which is then returned.

Note

It'd be nice to eventually be raster/vector neutral.

Definition at line 495 of file qgsproviderregistry.cpp.

void * QgsProviderRegistry::function ( const QString providerKey,
const QString functionName 
)

Get pointer to provider function.

Parameters
providerKeyidentificator of the provider
functionNamename of function
Returns
pointer to function or NULL on error

Definition at line 445 of file qgsproviderregistry.cpp.

QgsProviderRegistry * QgsProviderRegistry::instance ( QString  pluginPath = QString::null)
static

means of accessing canonical single instance

Definition at line 49 of file qgsproviderregistry.cpp.

QString QgsProviderRegistry::library ( const QString providerKey) const

Return path for the library of the provider.

Definition at line 269 of file qgsproviderregistry.cpp.

QDir const & QgsProviderRegistry::libraryDirectory ( ) const

return library directory where plugins are found

Definition at line 322 of file qgsproviderregistry.cpp.

QString QgsProviderRegistry::pluginList ( bool  asHtml = false) const

Return list of provider plugins found.

Definition at line 282 of file qgsproviderregistry.cpp.

QString QgsProviderRegistry::protocolDrivers ( ) const
virtual

return a string containing the available protocol drivers

Definition at line 515 of file qgsproviderregistry.cpp.

QgsDataProvider * QgsProviderRegistry::provider ( const QString providerKey,
const QString dataSource 
)

Create an instance of the provider.

Copied from QgsVectorLayer::setDataProvider TODO: Make it work in the generic environment.

Parameters
providerKeyidentificator of the provider
dataSourcestring containing data source for the provider
Returns
instance of provider or NULL on error

TODO: Is this class really the best place to put a data provider loader? It seems more sensible to provide the code in one place rather than in qgsrasterlayer, qgsvectorlayer, serversourceselect, etc.

Definition at line 340 of file qgsproviderregistry.cpp.

int QgsProviderRegistry::providerCapabilities ( const QString providerKey) const

Return the provider capabilities.

Parameters
providerKeyidentificator of the provider
Note
Added in 2.6

Definition at line 394 of file qgsproviderregistry.cpp.

QLibrary * QgsProviderRegistry::providerLibrary ( const QString providerKey) const

Definition at line 464 of file qgsproviderregistry.cpp.

QStringList QgsProviderRegistry::providerList ( ) const

Return list of available providers by their keys.

Definition at line 520 of file qgsproviderregistry.cpp.

const QgsProviderMetadata * QgsProviderRegistry::providerMetadata ( const QString providerKey) const

Return metadata of the provider or NULL if not found.

Definition at line 530 of file qgsproviderregistry.cpp.

void QgsProviderRegistry::registerGuis ( QWidget widget)

Definition at line 480 of file qgsproviderregistry.cpp.

QWidget * QgsProviderRegistry::selectWidget ( const QString providerKey,
QWidget parent = 0,
Qt::WindowFlags  fl = 0 
)

Definition at line 414 of file qgsproviderregistry.cpp.

void QgsProviderRegistry::setLibraryDirectory ( const QDir path)

Set library directory where to search for plugins.

Definition at line 316 of file qgsproviderregistry.cpp.


The documentation for this class was generated from the following files: