29#include "moc_qgsprovidermetadata.cpp"
31using namespace Qt::StringLiterals;
42 , mCreateFunction( createFunc )
47 qDeleteAll( mProviderConnections );
92 return mCreateFunction;
108 return QList<QgsMeshDriverMetadata>();
118 return QList<Qgis::LayerType>();
128 return QStringList();
133 return QList<QgsProviderSublayerDetails>();
138 if ( mCreateFunction )
140 return mCreateFunction( uri, options, flags );
147 if ( value.toString().compare( u
"yes"_s, Qt::CaseInsensitive ) == 0 || value.toString().compare( u
"1"_s, Qt::CaseInsensitive ) == 0 || value.toString().compare( u
"true"_s, Qt::CaseInsensitive ) == 0 )
149 uri[parameter] =
true;
151 else if ( value.toString().compare( u
"no"_s, Qt::CaseInsensitive ) == 0
152 || value.toString().compare( u
"0"_s, Qt::CaseInsensitive ) == 0
153 || value.toString().compare( u
"false"_s, Qt::CaseInsensitive ) == 0 )
155 uri[parameter] =
false;
161 if ( uri.value( parameter, QString() ).toString().compare( u
"yes"_s, Qt::CaseInsensitive ) == 0
162 || uri.value( parameter, QString() ).toString().compare( u
"1"_s, Qt::CaseInsensitive ) == 0
163 || uri.value( parameter, QString() ).toString().compare( u
"true"_s, Qt::CaseInsensitive ) == 0 )
167 else if ( uri.value( parameter, QString() ).toString().compare( u
"no"_s, Qt::CaseInsensitive ) == 0
168 || uri.value( parameter, QString() ).toString().compare( u
"0"_s, Qt::CaseInsensitive ) == 0
169 || uri.value( parameter, QString() ).toString().compare( u
"false"_s, Qt::CaseInsensitive ) == 0 )
179 return QVariantMap();
212 const QString &,
const QgsFields &,
Qgis::WkbType,
const QgsCoordinateReferenceSystem &,
bool, QMap<int, int> &, QString &errorMessage,
const QMap<QString, QVariant> *, QString &
215 errorMessage = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"createEmptyLayer"_s );
221 errorMessage = QObject::tr(
"The %1 provider does not support database creation" ).arg(
key() );
242 return QList<QPair<QString, QString> >();
247 return QList<QgsDataItemProvider *>();
252 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"listStyles"_s );
265 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"getStyleById"_s );
271 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"deleteStyleById"_s );
275bool QgsProviderMetadata::saveStyle(
const QString &,
const QString &,
const QString &,
const QString &,
const QString &,
const QString &,
bool, QString &errCause )
277 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"saveStyle"_s );
283 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"loadStyle"_s );
289 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"loadStoredStyle"_s );
300 errCause = QObject::tr(
"Provider %1 has no %2 method" ).arg(
key(), u
"createDb"_s );
322 const QMap<QString, QgsAbstractProviderConnection *> constConns {
connections( cached ) };
323 const QStringList constKeys { constConns.keys() };
324 for (
const QString &
key : constKeys )
328 return constConns.value(
key );
343 Q_UNUSED( configuration );
356 Q_UNUSED( connection )
364 const bool isNewConnection = !
connections().contains( name );
366 mProviderConnections.clear();
368 if ( !isNewConnection )
377 QMap<QString, T *> result;
379 const QStringList constConnKeys { constConns.keys() };
380 for (
const auto &
c : constConnKeys )
382 T *casted {
static_cast<T *
>( constConns.value(
c ) ) };
385 result.insert(
c, casted );
397 , mWriteDatasetOnFileSuffix( writeDatasetOnfileSuffix )
406 , mWriteDatasetOnFileSuffix( writeDatasetOnfileSuffix )
408 , mMaxVerticesPerFace( maxVerticesPerface )
413 return mCapabilities;
428 return mWriteDatasetOnFileSuffix;
433 return mWriteMeshFrameOnFileSuffix;
438 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.
SourceHierarchyLevel
Defines the structural levels within a data source hierarchy.
WkbType
The WKB type describes the number of dimensions a geometry has.
An interface for data provider connections.
virtual void store(const QString &name) const =0
Stores the connection in the settings.
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.
A container for the context for various read/write operations on objects.
const QgsPathResolver & pathResolver() const
Returns path resolver for conversion between relative and absolute paths.
Allows creation of a multi-layer database-side transaction.
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.