19 #ifndef QGSPROVIDERMETADATA_H
20 #define QGSPROVIDERMETADATA_H
24 #include <QVariantMap>
32 #include "qgis_core.h"
65 CanWriteFaceDatasets = 1 << 0,
66 CanWriteVertexDatasets = 1 << 1,
67 CanWriteEdgeDatasets = 1 << 2,
68 CanWriteMeshData = 1 << 3,
71 Q_ENUM( MeshDriverCapability )
72 Q_DECLARE_FLAGS( MeshDriverCapabilities, MeshDriverCapability )
73 Q_FLAG( MeshDriverCapabilities )
86 const QString &description,
87 const MeshDriverCapabilities &capabilities,
88 const QString &writeDatasetOnFileSuffix );
93 MeshDriverCapabilities capabilities() const;
103 QString description() const;
108 QString writeDatasetOnFileSuffix() const;
112 QString mDescription;
113 MeshDriverCapabilities mCapabilities;
114 QString mWriteDatasetOnFileSuffix;
154 QgsProviderMetadata(
const QString &key,
const QString &description,
const QString &library = QString() );
179 QString description()
const;
203 virtual
void initProvider();
209 virtual
void cleanupProvider();
230 virtual QString filters( FilterType type );
237 virtual QList<QgsMeshDriverMetadata> meshDriversMetadata();
250 QgsDataProvider::ReadFlags flags = QgsDataProvider::ReadFlags() )
SIP_FACTORY;
258 static
void setBoolParameter( QVariantMap &uri, const QString ¶meter, const QVariant &value );
266 static
bool boolParameter( const QVariantMap &uri, const QString ¶meter,
bool defaultValue = false );
281 QMap<int, int> &oldToNewAttrIdxMap,
282 QString &errorMessage,
283 const QMap<QString, QVariant> *options );
292 const QString &format,
297 double *geoTransform,
299 const QStringList &createOptions = QStringList() )
SIP_FACTORY;
305 virtual
bool createMeshData(
308 const QString &driverName,
315 virtual QList<QPair<QString, QString> > pyramidResamplingMethods();
334 virtual QVariantMap decodeUri( const QString &uri );
344 virtual QString encodeUri( const QVariantMap &parts );
359 virtual
int listStyles( const QString &uri, QStringList &ids, QStringList &names,
360 QStringList &descriptions, QString &errCause );
366 virtual QString getStyleById( const QString &uri, QString styleId, QString &errCause );
372 virtual
bool deleteStyleById( const QString &uri, QString styleId, QString &errCause );
378 virtual
bool saveStyle( const QString &uri, const QString &qmlStyle, const QString &sldStyle,
379 const QString &styleName, const QString &styleDescription,
380 const QString &uiFileContent,
bool useAsDefault, QString &errCause );
386 virtual QString loadStyle( const QString &uri, QString &errCause );
392 virtual
bool createDb( const QString &dbPath, QString &errCause );
442 template <
typename T> QMap<QString, T *>connections(
bool cached =
true );
520 template <
class T_prov
ider_conn,
class T_conn> QMap<QString, QgsAbstractProviderConnection *> connectionsProtected(
bool cached =
true )
522 if ( ! cached || mProviderConnections.isEmpty() )
524 qDeleteAll( mProviderConnections );
525 mProviderConnections.clear();
526 const auto connNames { T_conn::connectionList() };
527 for (
const auto &cname : connNames )
529 mProviderConnections.insert( cname,
new T_provider_conn( cname ) );
532 return mProviderConnections;
535 template <
class T_prov
ider_conn>
void deleteConnectionProtected(
const QString &name )
537 T_provider_conn conn( name );
539 mProviderConnections.clear();
540 emit connectionDeleted( name );
544 QMap<QString, QgsAbstractProviderConnection *> mProviderConnections;
555 QString mDescription;
561 CreateDataProviderFunction mCreateFunction =
nullptr;
565 #endif //QGSPROVIDERMETADATA_H