QGIS API Documentation  3.6.0-Noosa (5873452)
qgsproviderregistry.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsproviderregistry.h - Singleton class for
3  registering data providers.
4  -------------------
5  begin : Sat Jan 10 2004
6  copyright : (C) 2004 by Gary E.Sherman
7  email : sherman at mrcc.com
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 #ifndef QGSPROVIDERREGISTRY_H
20 #define QGSPROVIDERREGISTRY_H
21 
22 #include <map>
23 
24 #include <QDir>
25 #include <QLibrary>
26 #include <QString>
27 
28 #include "qgsdataprovider.h"
29 #include "qgis_core.h"
30 #include "qgis_sip.h"
31 
32 
34 class QgsVectorLayer;
36 
37 
52 class CORE_EXPORT QgsProviderRegistry
53 {
54 
55  public:
56 
62  {
66  };
67 
69  static QgsProviderRegistry *instance( const QString &pluginPath = QString() );
70 
71  virtual ~QgsProviderRegistry();
72 
79  QString library( const QString &providerKey ) const;
80 
82  QString pluginList( bool asHtml = false ) const;
83 
87  QDir libraryDirectory() const;
88 
90  void setLibraryDirectory( const QDir &path );
91 
99  QgsDataProvider *createProvider( const QString &providerKey,
100  const QString &dataSource,
102 
108  int providerCapabilities( const QString &providerKey ) const;
109 
118  QVariantMap decodeUri( const QString &providerKey, const QString &uri );
119 
125  QWidget *createSelectionWidget( const QString &providerKey,
126  QWidget *parent = nullptr,
127  Qt::WindowFlags fl = Qt::WindowFlags(),
129 
137  QFunctionPointer function( const QString &providerKey,
138  const QString &functionName );
139 
147  QLibrary *createProviderLibrary( const QString &providerKey ) const SIP_FACTORY;
148 
150  QStringList providerList() const;
151 
153  const QgsProviderMetadata *providerMetadata( const QString &providerKey ) const;
154 
168  virtual QString fileVectorFilters() const;
169 
181  virtual QString fileRasterFilters() const;
182 
196  virtual QString fileMeshFilters() const;
197 
211  virtual QString fileMeshDatasetFilters() const;
212 
214  virtual QString databaseDrivers() const;
216  virtual QString directoryDrivers() const;
218  virtual QString protocolDrivers() const;
219 
220  void registerGuis( QWidget *widget );
221 
228  bool registerProvider( QgsProviderMetadata *providerMetadata SIP_TRANSFER );
229 
252  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
253 
255  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
256 
257  private:
259  QgsProviderRegistry( const QString &pluginPath );
260 
261 #ifdef SIP_RUN
262  QgsProviderRegistry( const QString &pluginPath );
263 #endif
264 
265  void init();
266  void clean();
267 
269  Providers mProviders;
270 
272  QDir mLibraryDirectory;
273 
283  QString mVectorFileFilters;
284 
288  QString mRasterFileFilters;
289 
293  QString mMeshFileFilters;
294 
298  QString mMeshDatasetFileFilters;
299 
306  QString mDatabaseDrivers;
307 
313  QString mDirectoryDrivers;
314 
321  QString mProtocolDrivers;
322 
323 }; // class QgsProviderRegistry
324 
325 #endif //QGSPROVIDERREGISTRY_H
326 
WidgetMode
Different ways a source select dialog can be used (embedded is for the data source manager dialog) ...
Abstract base class for spatial data provider implementations.
#define SIP_SKIP
Definition: qgis_sip.h:119
#define SIP_TRANSFER
Definition: qgis_sip.h:36
#define SIP_FACTORY
Definition: qgis_sip.h:69
A registry / canonical manager of data providers.
Setting options for creating vector data providers.
Holds data provider key, description, and associated shared library file or function pointer informat...
std::map< QString, QgsProviderMetadata * > Providers
Open the given vector data source.
This class represents a coordinate reference system (CRS).
Represents a vector layer which manages a vector based data sets.