QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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, const Qt::WindowFlags& fl = Qt::WindowFlags() );
86 
87 #if QT_VERSION >= 0x050000
88 
93  QFunctionPointer function( const QString & providerKey,
94  const QString & functionName );
95 #else
96 
101  void *function( const QString & providerKey,
102  const QString & functionName );
103 #endif
104 
105  QLibrary *providerLibrary( const QString & providerKey ) const;
106 
108  QStringList providerList() const;
109 
111  const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
112 
125  virtual QString fileVectorFilters() const;
136  virtual QString fileRasterFilters() const;
138  virtual QString databaseDrivers() const;
140  virtual QString directoryDrivers() const;
142  virtual QString protocolDrivers() const;
143 
144  void registerGuis( QWidget *widget );
145 
167  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
168 
169 
171  typedef std::map<QString, QgsProviderMetadata*> Providers;
172 
173  private:
175  QgsProviderRegistry( const QString& pluginPath );
176 
177  void init();
178  void clean();
179 
181  Providers mProviders;
182 
184  QDir mLibraryDirectory;
185 
194  QString mVectorFileFilters;
197  QString mRasterFileFilters;
203  QString mDatabaseDrivers;
208  QString mDirectoryDrivers;
214  QString mProtocolDrivers;
215 
216 }; // class QgsProviderRegistry
217 
218 #endif //QGSPROVIDERREGISTRY_H
219 
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.
Class for storing a coordinate reference system (CRS)
typedef WindowFlags
Represents a vector layer which manages a vector based data sets.