QGIS API Documentation  2.99.0-Master (13a3f2f)
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 
57  static QgsProviderRegistry *instance( const QString &pluginPath = QString::null );
58 
59  virtual ~QgsProviderRegistry();
60 
67  QString library( const QString &providerKey ) const;
68 
70  QString pluginList( bool asHtml = false ) const;
71 
75  QDir libraryDirectory() const;
76 
78  void setLibraryDirectory( const QDir &path );
79 
86  QgsDataProvider *createProvider( const QString &providerKey,
87  const QString &dataSource ) SIP_FACTORY;
88 
93  int providerCapabilities( const QString &providerKey ) const;
94 
100  QWidget *createSelectionWidget( const QString &providerKey,
101  QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
102 
110  QFunctionPointer function( const QString &providerKey,
111  const QString &functionName );
112 
120  QLibrary *createProviderLibrary( const QString &providerKey ) const SIP_FACTORY;
121 
123  QStringList providerList() const;
124 
126  const QgsProviderMetadata *providerMetadata( const QString &providerKey ) const;
127 
140  virtual QString fileVectorFilters() const;
141 
152  virtual QString fileRasterFilters() const;
154  virtual QString databaseDrivers() const;
156  virtual QString directoryDrivers() const;
158  virtual QString protocolDrivers() const;
159 
160  void registerGuis( QWidget *widget );
161 
183  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
184 
186  SIP_SKIP typedef std::map<QString, QgsProviderMetadata *> Providers;
187 
188  private:
190  QgsProviderRegistry( const QString &pluginPath );
191 
192 #ifdef SIP_RUN
193  QgsProviderRegistry( const QString &pluginPath );
194 #endif
195 
196  void init();
197  void clean();
198 
200  Providers mProviders;
201 
203  QDir mLibraryDirectory;
204 
213  QString mVectorFileFilters;
214 
217  QString mRasterFileFilters;
218 
224  QString mDatabaseDrivers;
225 
230  QString mDirectoryDrivers;
231 
237  QString mProtocolDrivers;
238 
239 }; // class QgsProviderRegistry
240 
241 #endif //QGSPROVIDERREGISTRY_H
242 
Abstract base class for spatial data provider implementations.
#define SIP_SKIP
Definition: qgis_sip.h:102
#define SIP_FACTORY
Definition: qgis_sip.h:57
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.