QGIS API Documentation  2.99.0-Master (01468d0)
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 
51 class CORE_EXPORT QgsProviderRegistry
52 {
53 
54  public:
55 
59  {
63  };
64 
66  static QgsProviderRegistry *instance( const QString &pluginPath = QString() );
67 
68  virtual ~QgsProviderRegistry();
69 
76  QString library( const QString &providerKey ) const;
77 
79  QString pluginList( bool asHtml = false ) const;
80 
84  QDir libraryDirectory() const;
85 
87  void setLibraryDirectory( const QDir &path );
88 
95  QgsDataProvider *createProvider( const QString &providerKey,
96  const QString &dataSource ) SIP_FACTORY;
97 
102  int providerCapabilities( const QString &providerKey ) const;
103 
109  QWidget *createSelectionWidget( const QString &providerKey,
110  QWidget *parent = nullptr,
111  Qt::WindowFlags fl = Qt::WindowFlags(),
112  QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
113 
121  QFunctionPointer function( const QString &providerKey,
122  const QString &functionName );
123 
131  QLibrary *createProviderLibrary( const QString &providerKey ) const SIP_FACTORY;
132 
134  QStringList providerList() const;
135 
137  const QgsProviderMetadata *providerMetadata( const QString &providerKey ) const;
138 
151  virtual QString fileVectorFilters() const;
152 
163  virtual QString fileRasterFilters() const;
165  virtual QString databaseDrivers() const;
167  virtual QString directoryDrivers() const;
169  virtual QString protocolDrivers() const;
170 
171  void registerGuis( QWidget *widget );
172 
194  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
195 
197  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
198 
199  private:
201  QgsProviderRegistry( const QString &pluginPath );
202 
203 #ifdef SIP_RUN
204  QgsProviderRegistry( const QString &pluginPath );
205 #endif
206 
207  void init();
208  void clean();
209 
211  Providers mProviders;
212 
214  QDir mLibraryDirectory;
215 
224  QString mVectorFileFilters;
225 
228  QString mRasterFileFilters;
229 
235  QString mDatabaseDrivers;
236 
241  QString mDirectoryDrivers;
242 
248  QString mProtocolDrivers;
249 
250 }; // class QgsProviderRegistry
251 
252 #endif //QGSPROVIDERREGISTRY_H
253 
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.