QGIS API Documentation  2.99.0-Master (0a63d1f)
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 
30 
31 class QgsDataProvider;
33 class QgsVectorLayer;
35 
36 
47 class CORE_EXPORT QgsProviderRegistry
48 {
49 
50  public:
51 
53  static QgsProviderRegistry* instance( const QString& pluginPath = QString::null );
54 
56  virtual ~QgsProviderRegistry();
57 
59  QString library( const QString & providerKey ) const;
60 
62  QString pluginList( bool asHtml = false ) const;
63 
65  QDir libraryDirectory() const;
66 
68  void setLibraryDirectory( const QDir & path );
69 
75  QgsDataProvider *provider( const QString & providerKey,
76  const QString & dataSource );
77 
82  int providerCapabilities( const QString& providerKey ) const;
83 
86  QWidget *selectWidget( const QString & providerKey,
87  QWidget * parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
88 
94  QFunctionPointer function( const QString & providerKey,
95  const QString & functionName );
96 
97  QLibrary *providerLibrary( const QString & providerKey ) const;
98 
100  QStringList providerList() const;
101 
103  const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
104 
117  virtual QString fileVectorFilters() const;
118 
129  virtual QString fileRasterFilters() const;
131  virtual QString databaseDrivers() const;
133  virtual QString directoryDrivers() const;
135  virtual QString protocolDrivers() const;
136 
137  void registerGuis( QWidget *widget );
138 
160  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
161 
162 
164  typedef std::map<QString, QgsProviderMetadata*> Providers;
165 
166  private:
168  QgsProviderRegistry( const QString& pluginPath );
169 
170  void init();
171  void clean();
172 
174  Providers mProviders;
175 
177  QDir mLibraryDirectory;
178 
187  QString mVectorFileFilters;
188 
191  QString mRasterFileFilters;
192 
198  QString mDatabaseDrivers;
199 
204  QString mDirectoryDrivers;
205 
211  QString mProtocolDrivers;
212 
213 }; // class QgsProviderRegistry
214 
215 #endif //QGSPROVIDERREGISTRY_H
216 
Abstract base class for spatial data provider implementations.
std::map< QString, QgsProviderMetadata * > Providers
Open the given vector data source.
A registry / canonical manager of data providers.
Holds data provider key, description, and associated shared library file information.
This class represents a coordinate reference system (CRS).
Represents a vector layer which manages a vector based data sets.