QGIS API Documentation  3.2.0-Bonn (bc43194)
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 
115  QWidget *createSelectionWidget( const QString &providerKey,
116  QWidget *parent = nullptr,
117  Qt::WindowFlags fl = Qt::WindowFlags(),
119 
127  QFunctionPointer function( const QString &providerKey,
128  const QString &functionName );
129 
137  QLibrary *createProviderLibrary( const QString &providerKey ) const SIP_FACTORY;
138 
140  QStringList providerList() const;
141 
143  const QgsProviderMetadata *providerMetadata( const QString &providerKey ) const;
144 
158  virtual QString fileVectorFilters() const;
159 
171  virtual QString fileRasterFilters() const;
172 
174  virtual QString databaseDrivers() const;
176  virtual QString directoryDrivers() const;
178  virtual QString protocolDrivers() const;
179 
180  void registerGuis( QWidget *widget );
181 
188  bool registerProvider( QgsProviderMetadata *providerMetadata SIP_TRANSFER );
189 
212  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
213 
215  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
216 
217  private:
219  QgsProviderRegistry( const QString &pluginPath );
220 
221 #ifdef SIP_RUN
222  QgsProviderRegistry( const QString &pluginPath );
223 #endif
224 
225  void init();
226  void clean();
227 
229  Providers mProviders;
230 
232  QDir mLibraryDirectory;
233 
243  QString mVectorFileFilters;
244 
248  QString mRasterFileFilters;
249 
256  QString mDatabaseDrivers;
257 
263  QString mDirectoryDrivers;
264 
271  QString mProtocolDrivers;
272 
273 }; // class QgsProviderRegistry
274 
275 #endif //QGSPROVIDERREGISTRY_H
276 
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.