26 QString
const &description,
27 QString
const &library )
29 , mDescription( description )
35 , mDescription( description )
36 , mCreateFunction( createFunc )
41 qDeleteAll( mProviderConnections );
56 return QgsProviderMetadata::ProviderMetadataCapabilities();
61 return QgsProviderMetadata::ProviderCapabilities();
71 return mCreateFunction;
91 return QList<QgsMeshDriverMetadata>();
101 return QList<QgsMapLayerType>();
111 QgsDataProvider::ReadFlags flags )
113 if ( mCreateFunction )
115 return mCreateFunction( uri, options, flags );
122 if ( value.toString().compare( QStringLiteral(
"yes" ), Qt::CaseInsensitive ) == 0 ||
123 value.toString().compare( QStringLiteral(
"1" ), Qt::CaseInsensitive ) == 0 ||
124 value.toString().compare( QStringLiteral(
"true" ), Qt::CaseInsensitive ) == 0 )
126 uri[ parameter ] =
true;
128 else if ( value.toString().compare( QStringLiteral(
"no" ), Qt::CaseInsensitive ) == 0 ||
129 value.toString().compare( QStringLiteral(
"0" ), Qt::CaseInsensitive ) == 0 ||
130 value.toString().compare( QStringLiteral(
"false" ), Qt::CaseInsensitive ) == 0 )
132 uri[ parameter ] =
false;
138 if ( uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"yes" ), Qt::CaseInsensitive ) == 0 ||
139 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"1" ), Qt::CaseInsensitive ) == 0 ||
140 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"true" ), Qt::CaseInsensitive ) == 0 )
144 else if ( uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"no" ), Qt::CaseInsensitive ) == 0 ||
145 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"0" ), Qt::CaseInsensitive ) == 0 ||
146 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"false" ), Qt::CaseInsensitive ) == 0 )
156 return QVariantMap();
167 bool, QMap<int, int> &,
168 QString &errorMessage,
const QMap<QString, QVariant> * )
170 errorMessage = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"createEmptyLayer" ) );
171 return Qgis::VectorExportResult::ErrorProviderUnsupportedFeature;
175 const QString &,
const QString &,
179 const QStringList & )
195 return QList<QPair<QString, QString> >();
200 return QList<QgsDataItemProvider *>();
204 QStringList &, QString &errCause )
206 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"listStyles" ) );
212 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"getStyleById" ) );
218 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"deleteStyleById" ) );
223 const QString &,
const QString &,
bool, QString &errCause )
225 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"saveStyle" ) );
231 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"loadStyle" ) );
242 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"createDb" ) );
259 return connections<QgsAbstractDatabaseProviderConnection>( cached ) ;
264 const QMap<QString, QgsAbstractProviderConnection *> constConns {
connections( cached ) };
265 const QStringList constKeys { constConns.keys( ) };
266 for (
const QString &
key : constKeys )
270 return constConns.value(
key );
285 Q_UNUSED( configuration );
298 Q_UNUSED( connection )
306 const bool isNewConnection = !
connections().contains( name );
308 mProviderConnections.clear();
310 if ( !isNewConnection )
320 QMap<QString, T *> result;
322 const QStringList constConnKeys { constConns.keys() };
323 for (
const auto &
c : constConnKeys )
325 T *casted {
static_cast<T *
>( constConns.value(
c ) ) };
328 result.insert(
c, casted );
337 : mName( name ), mDescription( description ), mCapabilities( capabilities ), mWriteDatasetOnFileSuffix( writeDatasetOnfileSuffix )
343 return mCapabilities;
358 return mWriteDatasetOnFileSuffix;
VectorExportResult
Vector layer export result codes.
DataType
Raster data types.
The QgsAbstractProviderConnection provides an interface for data provider connections.
virtual void store(const QString &name) const =0
Stores the connection in the settings.
This class represents a coordinate reference system (CRS).
Abstract base class for spatial data provider implementations.
Container of fields for a vector layer.
Custom exception class which is raised when an operation is not supported.
Custom exception class for provider connection related exceptions.
Base class for raster data providers.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
Type
The WKB type describes the number of dimensions a geometry has.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Setting options for creating vector data providers.
Mesh - vertices, edges and faces.