QGIS API Documentation  3.0.2-Girona (307d082)
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 "qgis_core.h"
29 #include "qgis_sip.h"
30 
31 
32 class QgsDataProvider;
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 
98  QgsDataProvider *createProvider( const QString &providerKey,
99  const QString &dataSource ) SIP_FACTORY;
100 
106  int providerCapabilities( const QString &providerKey ) const;
107 
113  QWidget *createSelectionWidget( const QString &providerKey,
114  QWidget *parent = nullptr,
115  Qt::WindowFlags fl = Qt::WindowFlags(),
116  QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
117 
125  QFunctionPointer function( const QString &providerKey,
126  const QString &functionName );
127 
135  QLibrary *createProviderLibrary( const QString &providerKey ) const SIP_FACTORY;
136 
138  QStringList providerList() const;
139 
141  const QgsProviderMetadata *providerMetadata( const QString &providerKey ) const;
142 
156  virtual QString fileVectorFilters() const;
157 
169  virtual QString fileRasterFilters() const;
171  virtual QString databaseDrivers() const;
173  virtual QString directoryDrivers() const;
175  virtual QString protocolDrivers() const;
176 
177  void registerGuis( QWidget *widget );
178 
201  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
202 
204  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
205 
206  private:
208  QgsProviderRegistry( const QString &pluginPath );
209 
210 #ifdef SIP_RUN
211  QgsProviderRegistry( const QString &pluginPath );
212 #endif
213 
214  void init();
215  void clean();
216 
218  Providers mProviders;
219 
221  QDir mLibraryDirectory;
222 
232  QString mVectorFileFilters;
233 
237  QString mRasterFileFilters;
238 
245  QString mDatabaseDrivers;
246 
252  QString mDirectoryDrivers;
253 
260  QString mProtocolDrivers;
261 
262 }; // class QgsProviderRegistry
263 
264 #endif //QGSPROVIDERREGISTRY_H
265 
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_FACTORY
Definition: qgis_sip.h:69
A registry / canonical manager of 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.