QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsabstractproviderconnection.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsabstractproviderconnection.h - QgsAbstractProviderConnection
3 
4  ---------------------
5  begin : 2.8.2019
6  copyright : (C) 2019 by Alessandro Pasotti
7  email : elpaso at itopen dot it
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSABSTRACTPROVIDERCONNECTION_H
17 #define QGSABSTRACTPROVIDERCONNECTION_H
18 
19 #include <QString>
20 #include <QVariantMap>
21 
22 #include "qgis_core.h"
23 #include "qgis_sip.h"
24 #include "qgsdatasourceuri.h"
25 #include "qgsexception.h"
26 
45 {
46 
47 #ifdef SIP_RUN
49  if ( dynamic_cast<QgsAbstractDatabaseProviderConnection *>( sipCpp ) != NULL )
50  {
51  sipType = sipType_QgsAbstractDatabaseProviderConnection;
52  }
53  else if ( dynamic_cast<QgsAbstractProviderConnection *>( sipCpp ) != NULL )
54  {
55  sipType = sipType_QgsAbstractProviderConnection;
56  }
57  else
58  {
59  sipType = 0;
60  }
61  SIP_END
62 #endif
63 
64  public:
65 
70  QgsAbstractProviderConnection( const QString &name );
71 
77  QgsAbstractProviderConnection( const QString &uri, const QVariantMap &configuration );
78 
79  virtual ~QgsAbstractProviderConnection() = default;
80 
85  virtual void store( const QString &name ) const = 0;
86 
90  virtual void remove( const QString &name ) const = 0;
91 
95  virtual QIcon icon() const;
96 
100  QString uri() const;
101 
105  void setUri( const QString &uri );
106 
110  QVariantMap configuration() const;
111 
115  void setConfiguration( const QVariantMap &configuration );
116 
117  private:
118 
119  QString mUri;
120  QVariantMap mConfiguration;
121 
122 };
123 
124 #endif // QGSABSTRACTPROVIDERCONNECTION_H
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
qgsdatasourceuri.h
qgis_sip.h
qgsexception.h
QgsAbstractProviderConnection
The QgsAbstractProviderConnection provides an interface for data provider connections.
Definition: qgsabstractproviderconnection.h:44
SIP_END
#define SIP_END
Definition: qgis_sip.h:189
QgsAbstractDatabaseProviderConnection
The QgsAbstractDatabaseProviderConnection class provides common functionality for DB based connection...
Definition: qgsabstractdatabaseproviderconnection.h:40