~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/core/qgsproviderregistry.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *   (at your option) any later version.                                   *
16
16
 *                                                                         *
17
17
 ***************************************************************************/
18
 
 /* $Id: qgsproviderregistry.h 4502 2006-01-08 01:18:20Z timlinux $ */
19
 
 
 
18
/* $Id$ */
 
19
 
20
20
#ifndef QGSPROVIDERREGISTRY_H
21
21
#define QGSPROVIDERREGISTRY_H
22
22
 
23
23
#include <map>
24
24
 
25
 
#include <qdir.h>
26
 
#include <qstring.h>
27
 
 
 
25
#include <QDir>
 
26
#include <QString>
28
27
 
29
28
 
30
29
class QgsDataProvider;
31
30
class QgsProviderMetadata;
32
31
 
33
 
/** canonical manager of data providers
 
32
 
 
33
 
 
34
/** \ingroup core
 
35
  * A registry / canonical manager of data providers.
34
36
 
35
37
  This is a Singleton class that manages data provider access.
36
38
*/
37
 
class QgsProviderRegistry
 
39
class CORE_EXPORT QgsProviderRegistry
38
40
{
39
 
public:
40
 
 
41
 
    /** means of accessing canonical single instance
 
41
 
 
42
  public:
 
43
 
 
44
    /** means of accessing canonical single instance  */
 
45
    static QgsProviderRegistry* instance( QString pluginPath = QString::null );
 
46
 
 
47
    /** Virtual dectructor */
 
48
    virtual ~QgsProviderRegistry();
 
49
 
 
50
    /** Return path for the library of the provider */
 
51
    QString library( QString const & providerKey ) const;
 
52
 
 
53
    /** Return list of provider plugins found */
 
54
    QString pluginList( bool asHtml = false ) const;
 
55
 
 
56
    /** return library directory where plugins are found */
 
57
    const QDir & libraryDirectory() const;
 
58
 
 
59
    /** Set library directory where to search for plugins */
 
60
    void setLibraryDirectory( QDir const & path );
 
61
 
 
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
42
66
     */
43
 
    static QgsProviderRegistry* instance(QString pluginPath = QString::null);
44
 
    
45
 
    /** Virtual dtor */
46
 
    virtual ~QgsProviderRegistry() {};
47
 
 
48
 
    QString library(QString const & providerKey) const;
49
 
 
50
 
    QString pluginList(bool asHtml = false) const;
51
 
 
52
 
    /// return library directory where plugins are found
53
 
    QDir const & libraryDirectory() const;
54
 
 
55
 
    void setLibraryDirectory(QDir const & path);
56
 
 
57
 
    QgsDataProvider * getProvider( QString const & providerKey, 
58
 
                                   QString const & dataSource );
59
 
 
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 );
 
69
 
 
70
    /** Return list of available providers by their keys */
 
71
    QStringList providerList() const;
 
72
 
 
73
    /** Return metadata of the provider or NULL if not found */
 
74
    const QgsProviderMetadata* providerMetadata( const QString& providerKey ) const;
62
75
 
63
76
    /** return vector file filter string
64
77
 
73
86
      It'd be nice to eventually be raster/vector neutral.
74
87
    */
75
88
    virtual QString fileVectorFilters() const;
76
 
 
77
 
  /** open the given vector data source
78
 
  
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
 
91
    */
 
92
    virtual QString databaseDrivers() const;
 
93
    /** return a string containing the available directory drivers
 
94
    * @note this method was added in QGIS 1.1
 
95
    */
 
96
    virtual QString directoryDrivers() const;
 
97
    /** return a string containing the available protocol drivers
 
98
    * @note this method was added in QGIS 1.1
 
99
    */
 
100
    virtual QString protocolDrivers() const;
 
101
 
 
102
 
 
103
    /** open the given vector data source
 
104
 
 
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
84
110
    sdts++.)
85
 
  
 
111
 
86
112
    Called by QgsDataManager::open().
87
113
 
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
91
 
    
 
117
 
92
118
    Temporarily always returns false until finished implementing.
93
 
    
 
119
 
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.
97
 
  */
98
 
  QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
99
 
  
100
 
 
101
 
 
102
 
private:
 
123
    */
 
124
    //QgsDataProvider * openVector( QString const & dataSource, QString const & providerKey );
 
125
 
 
126
 
 
127
    /** type for data provider metadata associative container */
 
128
    typedef std::map<QString, QgsProviderMetadata*> Providers;
 
129
 
 
130
 
 
131
  private:
103
132
 
104
133
    /** ctor private since instance() creates it */
105
 
    QgsProviderRegistry(QString pluginPath);
 
134
    QgsProviderRegistry( QString pluginPath );
106
135
 
107
 
    /// pointer to canonical Singleton object
 
136
    /** pointer to canonical Singleton object */
108
137
    static QgsProviderRegistry* _instance;
109
138
 
110
 
    /// associative container of provider metadata handles
 
139
    /** associative container of provider metadata handles */
111
140
    Providers mProviders;
112
141
 
113
 
    /// directory in which provider plugins are installed
 
142
    /** directory in which provider plugins are installed */
114
143
    QDir mLibraryDirectory;
115
144
 
116
145
    /** file filter string for vector files
122
151
        one time.
123
152
     */
124
153
    QString mVectorFileFilters;
 
154
    /** Available database drivers string for vector databases
 
155
 
 
156
     This is a string of form:
 
157
     DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
 
158
        */
 
159
    QString mDatabaseDrivers;
 
160
    /** Available directory drivers string for vector databases
 
161
 
 
162
     This is a string of form:
 
163
     DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
 
164
        */
 
165
    QString mDirectoryDrivers;
 
166
    /** Available protocol drivers string for vector databases
 
167
 
 
168
     This is a string of form:
 
169
     DriverNameToShow,DriverName;DriverNameToShow,DriverName;...
 
170
        */
 
171
    QString mProtocolDrivers;
125
172
 
126
173
}; // class QgsProviderRegistry
127
174