QGIS API Documentation  2.14.0-Essen
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 
82  QWidget *selectWidget( const QString & providerKey,
83  QWidget * parent = nullptr, const Qt::WindowFlags& fl = nullptr );
84 
85 #if QT_VERSION >= 0x050000
86 
91  QFunctionPointer function( const QString & providerKey,
92  const QString & functionName );
93 #else
94 
99  void *function( const QString & providerKey,
100  const QString & functionName );
101 #endif
102 
103  QLibrary *providerLibrary( const QString & providerKey ) const;
104 
106  QStringList providerList() const;
107 
109  const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
110 
123  virtual QString fileVectorFilters() const;
134  virtual QString fileRasterFilters() const;
136  virtual QString databaseDrivers() const;
138  virtual QString directoryDrivers() const;
140  virtual QString protocolDrivers() const;
141 
142  void registerGuis( QWidget *widget );
143 
165  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
166 
167 
169  typedef std::map<QString, QgsProviderMetadata*> Providers;
170 
171  private:
173  QgsProviderRegistry( const QString& pluginPath );
174 
175  void init();
176  void clean();
177 
179  Providers mProviders;
180 
182  QDir mLibraryDirectory;
183 
192  QString mVectorFileFilters;
195  QString mRasterFileFilters;
201  QString mDatabaseDrivers;
206  QString mDirectoryDrivers;
212  QString mProtocolDrivers;
213 
214 }; // class QgsProviderRegistry
215 
216 #endif //QGSPROVIDERREGISTRY_H
217 
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.