Quantum GIS API Documentation  1.8
src/core/qgsproviderregistry.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                     qgsproviderregistry.h  -  Singleton class for
00003                     registering data providers.
00004                              -------------------
00005     begin                : Sat Jan 10 2004
00006     copyright            : (C) 2004 by Gary E.Sherman
00007     email                : sherman at mrcc.com
00008  ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 #ifndef QGSPROVIDERREGISTRY_H
00020 #define QGSPROVIDERREGISTRY_H
00021 
00022 #include <map>
00023 
00024 #include <QDir>
00025 #include <QLibrary>
00026 #include <QString>
00027 
00028 
00029 class QgsDataProvider;
00030 class QgsProviderMetadata;
00031 class QgsVectorLayer;
00032 class QgsCoordinateReferenceSystem;
00033 
00034 
00040 class CORE_EXPORT QgsProviderRegistry
00041 {
00042 
00043   public:
00044 
00046     static QgsProviderRegistry* instance( QString pluginPath = QString::null );
00047 
00049     virtual ~QgsProviderRegistry();
00050 
00052     QString library( QString const & providerKey ) const;
00053 
00055     QString pluginList( bool asHtml = false ) const;
00056 
00058     const QDir & libraryDirectory() const;
00059 
00061     void setLibraryDirectory( QDir const & path );
00062 
00068     QgsDataProvider *provider( const QString & providerKey,
00069                                const QString & dataSource );
00070 
00071     QWidget *selectWidget( const QString & providerKey,
00072                            QWidget * parent = 0, Qt::WFlags fl = 0 );
00073 
00079     void *function( const QString & providerKey,
00080                     const QString & functionName );
00081 
00082     QLibrary *providerLibrary( const QString & providerKey ) const;
00083 
00085     QStringList providerList() const;
00086 
00088     const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
00089 
00102     virtual QString fileVectorFilters() const;
00106     virtual QString databaseDrivers() const;
00110     virtual QString directoryDrivers() const;
00114     virtual QString protocolDrivers() const;
00115 
00137     //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
00138 
00139 
00141     typedef std::map<QString, QgsProviderMetadata*> Providers;
00142 
00143   private:
00144 
00146     QgsProviderRegistry( QString pluginPath );
00147 
00149     static QgsProviderRegistry* _instance;
00150 
00152     Providers mProviders;
00153 
00155     QDir mLibraryDirectory;
00156 
00165     QString mVectorFileFilters;
00171     QString mDatabaseDrivers;
00177     QString mDirectoryDrivers;
00183     QString mProtocolDrivers;
00184 
00185 }; // class QgsProviderRegistry
00186 
00187 #endif //QGSPROVIDERREGISTRY_H
00188 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines