15
15
* (at your option) any later version. *
17
17
***************************************************************************/
18
/* $Id: qgsproviderregistry.h 4502 2006-01-08 01:18:20Z timlinux $ */
20
20
#ifndef QGSPROVIDERREGISTRY_H
21
21
#define QGSPROVIDERREGISTRY_H
30
29
class QgsDataProvider;
31
30
class QgsProviderMetadata;
33
/** canonical manager of data providers
35
* A registry / canonical manager of data providers.
35
37
This is a Singleton class that manages data provider access.
37
class QgsProviderRegistry
39
class CORE_EXPORT QgsProviderRegistry
41
/** means of accessing canonical single instance
44
/** means of accessing canonical single instance */
45
static QgsProviderRegistry* instance( QString pluginPath = QString::null );
47
/** Virtual dectructor */
48
virtual ~QgsProviderRegistry();
50
/** Return path for the library of the provider */
51
QString library( QString const & providerKey ) const;
53
/** Return list of provider plugins found */
54
QString pluginList( bool asHtml = false ) const;
56
/** return library directory where plugins are found */
57
const QDir & libraryDirectory() const;
59
/** Set library directory where to search for plugins */
60
void setLibraryDirectory( QDir const & path );
62
/** Create an instance of the provider
63
@param providerKey identificator of the provider
64
@param dataSource string containing data source for the provider
65
@return instance of provider or NULL on error
43
static QgsProviderRegistry* instance(QString pluginPath = QString::null);
46
virtual ~QgsProviderRegistry() {};
48
QString library(QString const & providerKey) const;
50
QString pluginList(bool asHtml = false) const;
52
/// return library directory where plugins are found
53
QDir const & libraryDirectory() const;
55
void setLibraryDirectory(QDir const & path);
57
QgsDataProvider * getProvider( QString const & providerKey,
58
QString const & dataSource );
60
/// type for data provider metadata associative container
61
typedef std::map<QString,QgsProviderMetadata*> Providers;
67
QgsDataProvider * getProvider( const QString & providerKey,
68
const QString & dataSource );
70
/** Return list of available providers by their keys */
71
QStringList providerList() const;
73
/** Return metadata of the provider or NULL if not found */
74
const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
63
76
/** return vector file filter string
73
86
It'd be nice to eventually be raster/vector neutral.
75
88
virtual QString fileVectorFilters() const;
77
/** open the given vector data source
79
Similar to open(QString const &), except that the user specifies a data provider
89
/** return a string containing the available database drivers
90
* @note this method was added in QGIS 1.1
92
virtual QString databaseDrivers() const;
93
/** return a string containing the available directory drivers
94
* @note this method was added in QGIS 1.1
96
virtual QString directoryDrivers() const;
97
/** return a string containing the available protocol drivers
98
* @note this method was added in QGIS 1.1
100
virtual QString protocolDrivers() const;
103
/** open the given vector data source
105
Similar to open(QString const &), except that the user specifies a data provider
80
106
with which to open the data source instead of using the default data provider
81
107
that QgsDataManager would figure out to use. This should be useful when (and if)
82
108
there will exist more than one data provider that can handle a given data
83
109
source. (E.g., use GDAL to open an SDTS file, or a different data provider that uses
86
112
Called by QgsDataManager::open().
88
114
@param name could be a file, URI
89
115
@param provider is the key for the dataprovider used to open name
90
116
@return NULL if unable to open vector data source
92
118
Temporarily always returns false until finished implementing.
94
120
Eventually would be nice if could make QgsDataManager smart
95
121
enough to figure out whether the given name mapped to a vector,
96
122
raster, or database source.
98
QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
124
//QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
127
/** type for data provider metadata associative container */
128
typedef std::map<QString, QgsProviderMetadata*> Providers;
104
133
/** ctor private since instance() creates it */
105
QgsProviderRegistry(QString pluginPath);
134
QgsProviderRegistry( QString pluginPath );
107
/// pointer to canonical Singleton object
136
/** pointer to canonical Singleton object */
108
137
static QgsProviderRegistry* _instance;
110
/// associative container of provider metadata handles
139
/** associative container of provider metadata handles */
111
140
Providers mProviders;
113
/// directory in which provider plugins are installed
142
/** directory in which provider plugins are installed */
114
143
QDir mLibraryDirectory;
116
145
/** file filter string for vector files
124
153
QString mVectorFileFilters;
154
/** Available database drivers string for vector databases
156
This is a string of form:
157
DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
159
QString mDatabaseDrivers;
160
/** Available directory drivers string for vector databases
162
This is a string of form:
163
DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
165
QString mDirectoryDrivers;
166
/** Available protocol drivers string for vector databases
168
This is a string of form:
169
DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
171
QString mProtocolDrivers;
126
173
}; // class QgsProviderRegistry