20#include "moc_qgsprovidermetadata.cpp"
28 QString
const &description,
29 QString
const &library )
31 , mDescription( description )
37 , mDescription( description )
38 , mCreateFunction( createFunc )
43 qDeleteAll( mProviderConnections );
88 return mCreateFunction;
108 return QList<QgsMeshDriverMetadata>();
118 return QList<Qgis::LayerType>();
128 return QStringList();
133 return QList<QgsProviderSublayerDetails>();
140 if ( mCreateFunction )
142 return mCreateFunction( uri, options, flags );
149 if ( value.toString().compare( QStringLiteral(
"yes" ), Qt::CaseInsensitive ) == 0 ||
150 value.toString().compare( QStringLiteral(
"1" ), Qt::CaseInsensitive ) == 0 ||
151 value.toString().compare( QStringLiteral(
"true" ), Qt::CaseInsensitive ) == 0 )
153 uri[ parameter ] =
true;
155 else if ( value.toString().compare( QStringLiteral(
"no" ), Qt::CaseInsensitive ) == 0 ||
156 value.toString().compare( QStringLiteral(
"0" ), Qt::CaseInsensitive ) == 0 ||
157 value.toString().compare( QStringLiteral(
"false" ), Qt::CaseInsensitive ) == 0 )
159 uri[ parameter ] =
false;
165 if ( uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"yes" ), Qt::CaseInsensitive ) == 0 ||
166 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"1" ), Qt::CaseInsensitive ) == 0 ||
167 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"true" ), Qt::CaseInsensitive ) == 0 )
171 else if ( uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"no" ), Qt::CaseInsensitive ) == 0 ||
172 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"0" ), Qt::CaseInsensitive ) == 0 ||
173 uri.value( parameter, QString() ).toString().compare( QStringLiteral(
"false" ), Qt::CaseInsensitive ) == 0 )
183 return QVariantMap();
212 bool, QMap<int, int> &,
213 QString &errorMessage,
const QMap<QString, QVariant> * )
215 errorMessage = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"createEmptyLayer" ) );
221 errorMessage = QObject::tr(
"The %1 provider does not support database creation" ).arg(
key() );
226 const QString &,
const QString &,
230 const QStringList & )
239 const QMap<QString, QString> & )
const
247 const QMap<QString, QString> & )
const
254 return QList<QPair<QString, QString> >();
259 return QList<QgsDataItemProvider *>();
263 QStringList &, QString &errCause )
265 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"listStyles" ) );
278 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"getStyleById" ) );
284 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"deleteStyleById" ) );
289 const QString &,
const QString &,
bool, QString &errCause )
291 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"saveStyle" ) );
297 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"loadStyle" ) );
303 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"loadStoredStyle" ) );
314 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), QStringLiteral(
"createDb" ) );
331 return connections<QgsAbstractDatabaseProviderConnection>( cached ) ;
336 const QMap<QString, QgsAbstractProviderConnection *> constConns {
connections( cached ) };
337 const QStringList constKeys { constConns.keys( ) };
338 for (
const QString &
key : constKeys )
342 return constConns.value(
key );
357 Q_UNUSED( configuration );
370 Q_UNUSED( connection )
378 const bool isNewConnection = !
connections().contains( name );
380 mProviderConnections.clear();
382 if ( !isNewConnection )
392 QMap<QString, T *> result;
394 const QStringList constConnKeys { constConns.keys() };
395 for (
const auto &
c : constConnKeys )
397 T *casted {
static_cast<T *
>( constConns.value(
c ) ) };
400 result.insert(
c, casted );
409 const QString &description,
411 const QString &writeDatasetOnfileSuffix )
413 , mDescription( description )
414 , mCapabilities( capabilities )
415 , mWriteDatasetOnFileSuffix( writeDatasetOnfileSuffix )
420 const QString &description,
422 const QString &writeDatasetOnfileSuffix,
423 const QString &writeMeshFrameOnFileSuffix,
424 int maxVerticesPerface )
426 , mDescription( description )
427 , mCapabilities( capabilities )
428 , mWriteDatasetOnFileSuffix( writeDatasetOnfileSuffix )
429 , mWriteMeshFrameOnFileSuffix( ( writeMeshFrameOnFileSuffix ) )
430 , mMaxVerticesPerFace( maxVerticesPerface )
436 return mCapabilities;
451 return mWriteDatasetOnFileSuffix;
456 return mWriteMeshFrameOnFileSuffix;
461 return mMaxVerticesPerFace;
QFlags< UriCleaningFlag > UriCleaningFlags
Flags for cleaning layer URIs.
FileFilterType
Type of file filters.
VectorExportResult
Vector layer export result codes.
@ ErrorProviderUnsupportedFeature
Provider does not support creation of empty layers.
@ RemoveCredentials
Completely remove credentials (eg passwords) from the URI. This flag is not compatible with the Redac...
@ RedactCredentials
Replace the value of credentials (eg passwords) with 'xxxxxxxx'. This flag is not compatible with the...
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
DataType
Raster data types.
QFlags< SublayerQueryFlag > SublayerQueryFlags
Sublayer query flags.
WkbType
The WKB type describes the number of dimensions a geometry has.
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.
static QString removePassword(const QString &aUri, bool hide=false)
Removes the password element from a URI.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Container of fields for a vector layer.
Custom exception class which is raised when an operation is not supported.
QString writePath(const QString &filename) const
Prepare a filename to save it to the project file.
QString readPath(const QString &filename) const
Turn filename read from the project file to an absolute path.
Custom exception class for provider connection related exceptions.
Base class for raster data providers.
The class is used as a container of context for various read/write operations on other objects.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
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.