QGIS API Documentation  2.99.0-Master (c558d51)
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 
29 class QgsDataProvider;
31 class QgsVectorLayer;
33 
34 
45 class CORE_EXPORT QgsProviderRegistry
46 {
47 
48  public:
49 
51  static QgsProviderRegistry* instance( const QString& pluginPath = QString::null );
52 
54  virtual ~QgsProviderRegistry();
55 
57  QString library( const QString & providerKey ) const;
58 
60  QString pluginList( bool asHtml = false ) const;
61 
63  const QDir & libraryDirectory() const;
64 
66  void setLibraryDirectory( const QDir & path );
67 
73  QgsDataProvider *provider( const QString & providerKey,
74  const QString & dataSource );
75 
80  int providerCapabilities( const QString& providerKey ) const;
81 
84  QWidget *selectWidget( const QString & providerKey,
85  QWidget * parent = nullptr, Qt::WindowFlags fl = Qt::WindowFlags() );
86 
92  QFunctionPointer function( const QString & providerKey,
93  const QString & functionName );
94 
95  QLibrary *providerLibrary( const QString & providerKey ) const;
96 
98  QStringList providerList() const;
99 
101  const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
102 
115  virtual QString fileVectorFilters() const;
116 
127  virtual QString fileRasterFilters() const;
129  virtual QString databaseDrivers() const;
131  virtual QString directoryDrivers() const;
133  virtual QString protocolDrivers() const;
134 
135  void registerGuis( QWidget *widget );
136 
158  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
159 
160 
162  typedef std::map<QString, QgsProviderMetadata*> Providers;
163 
164  private:
166  QgsProviderRegistry( const QString& pluginPath );
167 
168  void init();
169  void clean();
170 
172  Providers mProviders;
173 
175  QDir mLibraryDirectory;
176 
185  QString mVectorFileFilters;
186 
189  QString mRasterFileFilters;
190 
196  QString mDatabaseDrivers;
197 
202  QString mDirectoryDrivers;
203 
209  QString mProtocolDrivers;
210 
211 }; // class QgsProviderRegistry
212 
213 #endif //QGSPROVIDERREGISTRY_H
214 
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.