QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 
184  virtual QString databaseDrivers() const;
186  virtual QString directoryDrivers() const;
188  virtual QString protocolDrivers() const;
189 
190  void registerGuis( QWidget *widget );
191 
198  bool registerProvider( QgsProviderMetadata *providerMetadata SIP_TRANSFER );
199 
222  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
223 
225  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
226 
227  private:
229  QgsProviderRegistry( const QString &pluginPath );
230 
231 #ifdef SIP_RUN
232  QgsProviderRegistry( const QString &pluginPath );
233 #endif
234 
235  void init();
236  void clean();
237 
239  Providers mProviders;
240 
242  QDir mLibraryDirectory;
243 
253  QString mVectorFileFilters;
254 
258  QString mRasterFileFilters;
259 
266  QString mDatabaseDrivers;
267 
273  QString mDirectoryDrivers;
274 
281  QString mProtocolDrivers;
282 
283 }; // class QgsProviderRegistry
284 
285 #endif //QGSPROVIDERREGISTRY_H
286 
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.