QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
40 class CORE_EXPORT QgsProviderRegistry
41 {
42 
43  public:
44 
46  static QgsProviderRegistry* instance( QString pluginPath = QString::null );
47 
49  virtual ~QgsProviderRegistry();
50 
52  QString library( const QString & providerKey ) const;
53 
55  QString pluginList( bool asHtml = false ) const;
56 
58  const QDir & libraryDirectory() const;
59 
61  void setLibraryDirectory( const QDir & path );
62 
68  QgsDataProvider *provider( const QString & providerKey,
69  const QString & dataSource );
70 
75  int providerCapabilities( const QString& providerKey ) const;
76 
77  QWidget *selectWidget( const QString & providerKey,
78  QWidget * parent = 0, Qt::WindowFlags fl = 0 );
79 
85  void *function( const QString & providerKey,
86  const QString & functionName );
87 
88  QLibrary *providerLibrary( const QString & providerKey ) const;
89 
91  QStringList providerList() const;
92 
94  const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
95 
108  virtual QString fileVectorFilters() const;
119  virtual QString fileRasterFilters() const;
121  virtual QString databaseDrivers() const;
123  virtual QString directoryDrivers() const;
125  virtual QString protocolDrivers() const;
126 
127  void registerGuis( QWidget *widget );
128 
150  //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
151 
152 
154  typedef std::map<QString, QgsProviderMetadata*> Providers;
155 
156  private:
158  QgsProviderRegistry( QString pluginPath );
159 
161  Providers mProviders;
162 
164  QDir mLibraryDirectory;
165 
174  QString mVectorFileFilters;
177  QString mRasterFileFilters;
183  QString mDatabaseDrivers;
189  QString mDirectoryDrivers;
195  QString mProtocolDrivers;
196 
197 }; // class QgsProviderRegistry
198 
199 #endif //QGSPROVIDERREGISTRY_H
200