QGIS API Documentation  3.8.0-Zanzibar (11aff65)
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 
231  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
232 
233  private:
235  QgsProviderRegistry( const QString &pluginPath );
236 
237 #ifdef SIP_RUN
238  QgsProviderRegistry( const QString &pluginPath );
239 #endif
240 
241  void init();
242  void clean();
243 
245  Providers mProviders;
246 
248  QDir mLibraryDirectory;
249 
259  QString mVectorFileFilters;
260 
264  QString mRasterFileFilters;
265 
269  QString mMeshFileFilters;
270 
274  QString mMeshDatasetFileFilters;
275 
282  QString mDatabaseDrivers;
283 
289  QString mDirectoryDrivers;
290 
297  QString mProtocolDrivers;
298 
302  static bool exists();
303 
304  friend class QgsApplication;
305 
306 }; // class QgsProviderRegistry
307 
308 #endif //QGSPROVIDERREGISTRY_H
309 
WidgetMode
Different ways a source select dialog can be used (embedded is for the data source manager dialog) ...
Extends QApplication to provide access to QGIS specific resources such as theme paths, database paths etc.
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
Type for data provider metadata associative container.
This class represents a coordinate reference system (CRS).
Represents a vector layer which manages a vector based data sets.