QGIS API Documentation  2.99.0-Master (11bb234)
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 
101  QLibrary *providerLibrary( const QString &providerKey ) const;
102 
104  QStringList providerList() const;
105 
107  const QgsProviderMetadata *providerMetadata( const QString &providerKey ) const;
108 
121  virtual QString fileVectorFilters() const;
122 
133  virtual QString fileRasterFilters() const;
135  virtual QString databaseDrivers() const;
137  virtual QString directoryDrivers() const;
139  virtual QString protocolDrivers() const;
140 
141  void registerGuis( QWidget *widget );
142 
164  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
165 
166 
168  typedef std::map<QString, QgsProviderMetadata *> Providers;
169 
170  private:
172  QgsProviderRegistry( const QString &pluginPath );
173 
174  void init();
175  void clean();
176 
178  Providers mProviders;
179 
181  QDir mLibraryDirectory;
182 
191  QString mVectorFileFilters;
192 
195  QString mRasterFileFilters;
196 
202  QString mDatabaseDrivers;
203 
208  QString mDirectoryDrivers;
209 
215  QString mProtocolDrivers;
216 
217 }; // class QgsProviderRegistry
218 
219 #endif //QGSPROVIDERREGISTRY_H
220 
Abstract base class for spatial data provider implementations.
A registry / canonical manager of data providers.
Holds data provider key, description, and associated shared library file information.
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.