39#include "moc_qgsvectordataprovider.cpp"
53 return QStringLiteral(
"Generic vector file" );
136 return mErrors.isEmpty() ? QString() : mErrors.last();
167 Q_UNUSED( attributes )
175 Q_UNUSED( attributes )
183 Q_UNUSED( renamedAttributes )
207 Q_UNUSED( fieldIndex )
216 if ( fieldIndex < 0 || fieldIndex >= f.count() )
219 return f.at( fieldIndex ).constraints().constraints();
233 Q_UNUSED( geometry_map )
280 mEncoding = QTextCodec::codecForName(
"UTF-8" );
284 mEncoding = QTextCodec::codecForName( e.toLocal8Bit().constData() );
286 if ( !mEncoding && e != QLatin1String(
"System" ) )
301 mEncoding = QTextCodec::codecForName(
"System" );
307 mEncoding = QTextCodec::codecForLocale();
309 Q_ASSERT( mEncoding );
318 return mEncoding->name();
328 QStringList abilitiesList;
334 abilitiesList += tr(
"Add Features" );
339 abilitiesList += tr(
"Delete Features" );
344 abilitiesList += tr(
"Change Attribute Values" );
349 abilitiesList += tr(
"Add Attributes" );
354 abilitiesList += tr(
"Delete Attributes" );
359 abilitiesList += tr(
"Rename Attributes" );
365 abilitiesList += tr(
"Create Spatial Index" );
370 abilitiesList += tr(
"Create Attribute Indexes" );
375 abilitiesList += tr(
"Fast Access to Features at ID" );
380 abilitiesList += tr(
"Change Geometries" );
385 abilitiesList += tr(
"Presimplify Geometries" );
390 abilitiesList += tr(
"Presimplify Geometries with Validity Check" );
395 abilitiesList += tr(
"Simultaneous Geometry and Attribute Updates" );
400 abilitiesList += tr(
"Transactions" );
405 abilitiesList += tr(
"Curved Geometries" );
410 abilitiesList += tr(
"Feature Symbology" );
413 return abilitiesList.join( QLatin1String(
", " ) );
432 QMap<QString, int> resultMap;
435 for (
int i = 0; i < fieldsCopy.
count(); ++i )
437 resultMap.insert( fieldsCopy.
at( i ).
name(), i );
482 QgsDebugMsgLevel( QStringLiteral(
"field name = %1 type = %2 length = %3 precision = %4" )
484 QVariant::typeToName( field.
type() ) )
488 for (
const NativeType &nativeType : mNativeTypes )
490 QgsDebugMsgLevel( QStringLiteral(
"native field type = %1 min length = %2 max length = %3 min precision = %4 max precision = %5" )
491 .arg( QVariant::typeToName( nativeType.mType ) )
492 .arg( nativeType.mMinLen )
493 .arg( nativeType.mMaxLen )
494 .arg( nativeType.mMinPrec )
495 .arg( nativeType.mMaxPrec ), 2 );
497 if ( field.
type() != nativeType.mType )
503 if ( ( nativeType.mMinLen > 0 && field.
length() < nativeType.mMinLen ) ||
504 ( nativeType.mMaxLen > 0 && field.
length() > nativeType.mMaxLen ) )
514 if ( ( nativeType.mMinPrec > 0 && field.
precision() < nativeType.mMinPrec ) ||
515 ( nativeType.mMaxPrec > 0 && field.
precision() > nativeType.mMaxPrec ) )
526 QgsDebugError( QStringLiteral(
"no sufficient native type found" ) );
534 if ( index < 0 || index >=
fields().count() )
536 QgsDebugError(
"Warning: access requested to invalid field index: " + QString::number( index ) );
542 if ( !mCacheMinValues.contains( index ) )
545 return mCacheMinValues[index];
552 if ( index < 0 || index >=
fields().count() )
554 QgsDebugError(
"Warning: access requested to invalid field index: " + QString::number( index ) );
560 if ( !mCacheMaxValues.contains( index ) )
563 return mCacheMaxValues[index];
573 if ( index < 0 || index >=
fields().count() )
578 keys.append( index );
584 request.
setFilterExpression( QStringLiteral(
"\"%1\" ILIKE '%%2%'" ).arg( fieldName, substring ) );
591 const QString value = f.
attribute( index ).toString();
592 if ( !set.contains( value ) )
594 results.append( value );
598 if ( ( limit >= 0 && results.size() >= limit ) || ( feedback && feedback->
isCanceled() ) )
613 Q_UNUSED( parameters )
625 mCacheMinMaxDirty =
true;
626 mCacheMinValues.clear();
627 mCacheMaxValues.clear();
634 if ( !mCacheMinMaxDirty )
638 for (
int i = 0; i < flds.
count(); ++i )
640 if ( flds.
at( i ).
type() == QMetaType::Type::Int )
642 mCacheMinValues[i] = QVariant( std::numeric_limits<int>::max() );
643 mCacheMaxValues[i] = QVariant( std::numeric_limits<int>::lowest() );
645 else if ( flds.
at( i ).
type() == QMetaType::Type::LongLong )
647 mCacheMinValues[i] = QVariant( std::numeric_limits<qlonglong>::max() );
648 mCacheMaxValues[i] = QVariant( std::numeric_limits<qlonglong>::lowest() );
650 else if ( flds.
at( i ).
type() == QMetaType::Type::Double )
652 mCacheMinValues[i] = QVariant( std::numeric_limits<double>::max() );
653 mCacheMaxValues[i] = QVariant( std::numeric_limits<double>::lowest() );
658 mCacheMinValues[i] = QVariant();
659 mCacheMaxValues[i] = QVariant();
671 for (
const int attributeIndex : keys )
673 const QVariant &varValue = attrs.at( attributeIndex );
678 switch ( flds.
at( attributeIndex ).
type() )
680 case QMetaType::Type::Int:
682 const int value = varValue.toInt();
683 if ( value < mCacheMinValues[ attributeIndex ].toInt() )
684 mCacheMinValues[ attributeIndex ] = value;
685 if ( value > mCacheMaxValues[ attributeIndex ].toInt() )
686 mCacheMaxValues[ attributeIndex ] = value;
689 case QMetaType::Type::LongLong:
691 const qlonglong value = varValue.toLongLong();
692 if ( value < mCacheMinValues[ attributeIndex ].toLongLong() )
693 mCacheMinValues[ attributeIndex ] = value;
694 if ( value > mCacheMaxValues[ attributeIndex ].toLongLong() )
695 mCacheMaxValues[ attributeIndex ] = value;
698 case QMetaType::Type::Double:
700 const double value = varValue.toDouble();
701 if ( value < mCacheMinValues[ attributeIndex ].toDouble() )
702 mCacheMinValues[attributeIndex ] = value;
703 if ( value > mCacheMaxValues[ attributeIndex ].toDouble() )
704 mCacheMaxValues[ attributeIndex ] = value;
707 case QMetaType::Type::QDateTime:
709 const QDateTime value = varValue.toDateTime();
710 if ( value < mCacheMinValues[ attributeIndex ].toDateTime() || !mCacheMinValues[ attributeIndex ].
isValid() )
711 mCacheMinValues[attributeIndex ] = value;
712 if ( value > mCacheMaxValues[ attributeIndex ].toDateTime() || !mCacheMaxValues[ attributeIndex ].
isValid() )
713 mCacheMaxValues[ attributeIndex ] = value;
716 case QMetaType::Type::QDate:
718 const QDate value = varValue.toDate();
719 if ( value < mCacheMinValues[ attributeIndex ].toDate() || !mCacheMinValues[ attributeIndex ].
isValid() )
720 mCacheMinValues[attributeIndex ] = value;
721 if ( value > mCacheMaxValues[ attributeIndex ].toDate() || !mCacheMaxValues[ attributeIndex ].
isValid() )
722 mCacheMaxValues[ attributeIndex ] = value;
725 case QMetaType::Type::QTime:
727 const QTime value = varValue.toTime();
728 if ( value < mCacheMinValues[ attributeIndex ].toTime() || !mCacheMinValues[ attributeIndex ].
isValid() )
729 mCacheMinValues[attributeIndex ] = value;
730 if ( value > mCacheMaxValues[ attributeIndex ].toTime() || !mCacheMaxValues[ attributeIndex ].
isValid() )
731 mCacheMaxValues[ attributeIndex ] = value;
736 const QString value = varValue.toString();
737 if (
QgsVariantUtils::isNull( mCacheMinValues[ attributeIndex ] ) || value < mCacheMinValues[attributeIndex ].toString() )
739 mCacheMinValues[attributeIndex] = value;
741 if (
QgsVariantUtils::isNull( mCacheMaxValues[attributeIndex] ) || value > mCacheMaxValues[attributeIndex].toString() )
743 mCacheMaxValues[attributeIndex] = value;
751 mCacheMinMaxDirty =
false;
758 if ( !v.convert( type ) || value.isNull() )
776static bool _compareEncodings(
const QString &s1,
const QString &s2 )
778 return s1.toLower() < s2.toLower();
781static bool _removeDuplicateEncodings(
const QString &s1,
const QString &s2 )
783 return s1.compare( s2, Qt::CaseInsensitive ) == 0;
788 static std::once_flag initialized;
789 std::call_once( initialized, []
791 const auto codecs { QTextCodec::availableCodecs() };
792 for (
const QByteArray &codec : codecs )
797 smEncodings <<
"BIG5";
798 smEncodings <<
"BIG5-HKSCS";
799 smEncodings <<
"EUCJP";
800 smEncodings <<
"EUCKR";
801 smEncodings <<
"GB2312";
802 smEncodings <<
"GBK";
803 smEncodings <<
"GB18030";
804 smEncodings <<
"JIS7";
805 smEncodings <<
"SHIFT-JIS";
806 smEncodings <<
"TSCII";
807 smEncodings <<
"UTF-8";
808 smEncodings <<
"UTF-16";
809 smEncodings <<
"KOI8-R";
810 smEncodings <<
"KOI8-U";
811 smEncodings <<
"ISO8859-1";
812 smEncodings <<
"ISO8859-2";
813 smEncodings <<
"ISO8859-3";
814 smEncodings <<
"ISO8859-4";
815 smEncodings <<
"ISO8859-5";
816 smEncodings <<
"ISO8859-6";
817 smEncodings <<
"ISO8859-7";
818 smEncodings <<
"ISO8859-8";
819 smEncodings <<
"ISO8859-8-I";
820 smEncodings <<
"ISO8859-9";
821 smEncodings <<
"ISO8859-10";
822 smEncodings <<
"ISO8859-11";
823 smEncodings <<
"ISO8859-12";
824 smEncodings <<
"ISO8859-13";
825 smEncodings <<
"ISO8859-14";
826 smEncodings <<
"ISO8859-15";
827 smEncodings <<
"IBM 850";
828 smEncodings <<
"IBM 866";
829 smEncodings <<
"CP874";
830 smEncodings <<
"CP1250";
831 smEncodings <<
"CP1251";
832 smEncodings <<
"CP1252";
833 smEncodings <<
"CP1253";
834 smEncodings <<
"CP1254";
835 smEncodings <<
"CP1255";
836 smEncodings <<
"CP1256";
837 smEncodings <<
"CP1257";
838 smEncodings <<
"CP1258";
839 smEncodings <<
"Apple Roman";
840 smEncodings <<
"TIS-620";
841 smEncodings <<
"System";
845 std::sort( sEncodings.begin(), sEncodings.end(), _compareEncodings );
846 const auto last = std::unique( sEncodings.begin(), sEncodings.end(), _removeDuplicateEncodings );
847 sEncodings.erase( last, sEncodings.end() );
865 return !mErrors.isEmpty();
902 return QSet<QgsMapLayerDependency>();
937 if ( !convertedGeometry )
944 if ( convertedGeometry->
wkbType() == providerGeometryType )
949 std::unique_ptr< QgsAbstractGeometry > outputGeom;
957 if ( compoundCurve->
nCurves() == 1 )
960 if ( circularString )
962 outputGeom.reset( circularString->
clone() );
974 outputGeom.reset( curveGeom );
982 if ( segmentizedGeom )
984 outputGeom.reset( segmentizedGeom );
993 if ( geomCollection )
995 if ( geomCollection->
addGeometry( outputGeom ? outputGeom->clone() : convertedGeometry->
clone() ) )
997 outputGeom = std::move( collGeom );
1011 if ( firstGeom && firstGeom->
wkbType() == providerGeometryType )
1013 outputGeom.reset( firstGeom->
clone() );
1024 outputGeom.reset( convertedGeometry->
clone() );
1026 outputGeom->addZValue();
1033 outputGeom.reset( convertedGeometry->
clone() );
1035 outputGeom->addMValue();
1053QStringList QgsVectorDataProvider::sEncodings;
1059 return QList<QgsRelation>();
1072 return mTemporalCapabilities.get();
1079 return mTemporalCapabilities.get();
1086 return mElevationProperties.get();
1093 return mElevationProperties.get();
@ SelectAtId
Fast access to features using their ID.
@ ChangeFeatures
Supports joint updates for attributes and geometry. Providers supporting this should still define Cha...
@ SimplifyGeometries
Supports simplification of geometries on provider side according to a distance tolerance.
@ AddFeatures
Allows adding features.
@ SimplifyGeometriesWithTopologicalValidation
Supports topological simplification of geometries on provider side according to a distance tolerance.
@ CreateAttributeIndex
Can create indexes on provider's fields.
@ CircularGeometries
Supports circular geometry types (circularstring, compoundcurve, curvepolygon).
@ NoCapabilities
Provider has no capabilities.
@ ChangeGeometries
Allows modifications of geometries.
@ AddAttributes
Allows addition of new attributes (fields).
@ CreateSpatialIndex
Allows creation of spatial index.
@ RenameAttributes
Supports renaming attributes (fields).
@ DeleteFeatures
Allows deletion of features.
@ TransactionSupport
Supports transactions.
@ DeleteAttributes
Allows deletion of attributes (fields).
@ ChangeAttributeValues
Allows modification of attribute values.
@ FeatureSymbology
Provider is able retrieve embedded symbology associated with individual features.
QFlags< VectorLayerTypeFlag > VectorLayerTypeFlags
Vector layer type flags.
@ NoGeometry
Geometry is not required. It may still be returned if e.g. required for a filter condition.
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
FeatureAvailability
Possible return value for QgsFeatureSource::hasFeatures() to determine if a source is empty.
@ FeaturesAvailable
There is at least one feature available in this source.
@ NoFeaturesAvailable
There are certainly no features available in this source.
QFlags< VectorProviderCapability > VectorProviderCapabilities
Vector data provider capabilities.
Aggregate
Available aggregates to calculate.
@ SqlQuery
SQL query layer.
QFlags< VectorDataProviderAttributeEditCapability > VectorDataProviderAttributeEditCapabilities
Attribute editing capabilities which may be supported by vector data providers.
WkbType
The WKB type describes the number of dimensions a geometry has.
@ CircularString
CircularString.
Abstract base class for all geometries.
virtual QgsAbstractGeometry * segmentize(double tolerance=M_PI/180., SegmentationToleranceType toleranceType=MaximumAngle) const
Returns a version of the geometry without curves.
virtual QgsAbstractGeometry * toCurveType() const =0
Returns the geometry converted to the more generic curve type.
Qgis::WkbType wkbType() const
Returns the WKB type of the geometry.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
A 3-dimensional box composed of x, y, z coordinates.
Circular string geometry type.
QgsCircularString * clone() const override
Clones the geometry by performing a deep copy.
Compound curve geometry type.
int nCurves() const
Returns the number of curves in the geometry.
const QgsCurve * curveAt(int i) const
Returns the curve at the specified index.
Represents a coordinate reference system (CRS).
Base class for handling elevation related properties for a data provider.
virtual Qgis::DataProviderFlags flags() const
Returns the generic data provider flags.
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the coordinate system for the data source.
virtual QgsBox3D extent3D() const
Returns the 3D extent of the layer.
virtual bool isValid() const =0
Returns true if this is a valid layer.
QgsDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags())
Create a new dataprovider with the specified in the uri.
QgsDataSourceUri uri() const
Gets the data source specification.
virtual QgsRectangle extent() const =0
Returns the extent of the layer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Wrapper for iterator of features from vector data provider or vector layer.
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
Abstract base class for all 2D vector feature renderers.
Wraps a request for features to a vector layer (or directly its vector data provider).
QgsFeatureRequest & setFlags(Qgis::FeatureRequestFlags flags)
Sets flags that affect how features will be fetched.
QgsFeatureRequest & setLimit(long long limit)
Set the maximum number of features to request.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
QgsFeatureRequest & setFilterExpression(const QString &expression)
Set the filter expression.
QgsFeatureRequest & setNoAttributes()
Set that no attributes will be fetched.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Q_INVOKABLE QVariant attribute(const QString &name) const
Lookup attribute value by attribute name.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
bool isCanceled() const
Tells whether the operation has been canceled already.
Constraint
Constraints which may be present on a field.
QFlags< Constraint > Constraints
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
QgsAttributeList allAttributesList() const
Utility function to get list of attribute indexes.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
Q_INVOKABLE int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
virtual bool addGeometry(QgsAbstractGeometry *g)
Adds a geometry and takes ownership. Returns true in case of success.
int numGeometries() const
Returns the number of geometries within the collection.
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection.
static std::unique_ptr< QgsAbstractGeometry > geomFromWkbType(Qgis::WkbType t)
Returns empty geometry from wkb type.
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true, const char *file=__builtin_FILE(), const char *function=__builtin_FUNCTION(), int line=__builtin_LINE())
Adds a message to the log instance (and creates it if necessary).
A QTextCodec implementation which relies on OGR to do the text conversion.
static QStringList supportedCodecs()
Returns a list of supported text codecs.
A rectangle specified with double values.
static QMetaType::Type variantTypeToMetaType(QVariant::Type variantType)
Converts a QVariant::Type to a QMetaType::Type.
static bool isNull(const QVariant &variant, bool silenceNullWarnings=false)
Returns true if the specified variant should be considered a NULL value.
static QVariant createNullVariant(QMetaType::Type metaType)
Helper method to properly create a null QVariant from a metaType Returns the created QVariant.
Implementation of data provider temporal properties for QgsVectorDataProviders.
void pushError(const QString &msg) const
Push a notification about errors that happened in this providers scope.
QgsRectangle sourceExtent() const override
Returns the extent of all geometries from the source.
virtual bool cancelReload()
Cancels the current reloading of data.
QString lastError() const override
Returns the most recent error encountered by the sink, e.g.
void setNativeTypes(const QList< QgsVectorDataProvider::NativeType > &nativeTypes)
Set the list of native types supported by this provider.
virtual QList< QgsRelation > discoverRelations(const QgsVectorLayer *target, const QList< QgsVectorLayer * > &layers) const
Discover the available relations with the given layers.
static QStringList availableEncodings()
Returns a list of available encodings.
QString dataComment() const override
Returns a short comment for the data that this provider is providing access to (e....
virtual QVariant aggregate(Qgis::Aggregate aggregate, int index, const QgsAggregateCalculator::AggregateParameters ¶meters, QgsExpressionContext *context, bool &ok, QgsFeatureIds *fids=nullptr) const
Calculates an aggregated value from the layer's features.
bool supportedType(const QgsField &field) const
check if provider supports type of field
virtual bool changeGeometryValues(const QgsGeometryMap &geometry_map)
Changes geometries of existing features.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
Q_DECL_DEPRECATED QgsAttrPalIndexNameHash palAttributeIndexNames() const
Returns list of indexes to names for QgsPalLabeling fix.
QgsCoordinateReferenceSystem sourceCrs() const override
Returns the coordinate reference system for features in the source.
virtual QgsFeatureRenderer * createRenderer(const QVariantMap &configuration=QVariantMap()) const
Creates a new vector layer feature renderer, using provider backend specific information.
virtual QString geometryColumnName() const
Returns the name of the column storing geometry, if applicable.
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
void clearMinMaxCache()
Invalidates the min/max cache.
virtual bool truncate()
Removes all features from the layer.
virtual QStringList uniqueStringsMatching(int index, const QString &substring, int limit=-1, QgsFeedback *feedback=nullptr) const
Returns unique string values of an attribute which contain a specified subset string.
void raiseError(const QString &msg) const
Signals an error in this provider.
QTextCodec * textEncoding() const
Gets this providers encoding.
QgsVectorDataProvider(const QString &uri=QString(), const QgsDataProvider::ProviderOptions &providerOptions=QgsDataProvider::ProviderOptions(), Qgis::DataProviderReadFlags flags=Qgis::DataProviderReadFlags())
Constructor for a vector data provider.
friend class QgsTransaction
virtual bool isSqlQuery() const
Returns true if the layer is a query (SQL) layer.
void clearErrors()
Clear recorded errors.
QStringList errors() const
Gets recorded errors.
virtual bool empty() const
Returns true if the layer does not contain any feature.
virtual Q_INVOKABLE Qgis::VectorProviderCapabilities capabilities() const
Returns flags containing the supported capabilities.
QList< QgsVectorDataProvider::NativeType > nativeTypes() const
Returns the names of the supported types.
QgsBox3D sourceExtent3D() const override
Returns the 3D extent of all geometries from the source.
virtual QgsAttributeList pkAttributeIndexes() const
Returns list of indexes of fields that make up the primary key.
virtual void handlePostCloneOperations(QgsVectorDataProvider *source)
Handles any post-clone operations required after this vector data provider was cloned from the source...
QgsGeometry convertToProviderType(const QgsGeometry &geom) const
Converts the geometry to the provider type if possible / necessary.
virtual bool changeFeatures(const QgsChangedAttributesMap &attr_map, const QgsGeometryMap &geometry_map)
Changes attribute values and geometries of existing features.
virtual QSet< QgsMapLayerDependency > dependencies() const
Gets the list of layer ids on which this layer depends.
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
virtual QString defaultValueClause(int fieldIndex) const
Returns any default value clauses which are present at the provider for a specified field index.
virtual void setEncoding(const QString &e)
Set encoding used for accessing data from layer.
virtual bool changeAttributeValues(const QgsChangedAttributesMap &attr_map)
Changes attribute values of existing features.
virtual bool deleteFeatures(const QgsFeatureIds &id)
Deletes one or more features from the provider.
virtual Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const
Returns the vector layer type flags.
QVariant maximumValue(int index) const override
Returns the maximum value of an attribute.
virtual bool createAttributeIndex(int field)
Create an attribute index on the datasource.
bool addFeatures(QgsFeatureList &flist, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags()) override
Adds a list of features to the sink.
QgsDataProviderElevationProperties * elevationProperties() override
Returns the provider's elevation properties.
QgsFields fields() const override=0
Returns the fields associated with this data provider.
QMap< QString, int > fieldNameMap() const
Returns a map where the key is the name of the field and the value is its index.
Qgis::WkbType wkbType() const override=0
Returns the geometry type which is returned by this layer.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest()) const override=0
Query the provider for features specified in request.
virtual QgsAttributeList attributeIndexes() const
Returns list of indexes to fetch all attributes in nextFeature().
virtual bool addAttributes(const QList< QgsField > &attributes)
Adds new attributes to the provider.
QVariant minimumValue(int index) const override
Returns the minimum value of an attribute.
void fillMinMaxCache() const
Populates the cache of minimum and maximum attribute values.
QString encoding() const
Returns the encoding which is used for accessing data.
virtual QVariant defaultValue(int fieldIndex) const
Returns any literal default values which are present at the provider for a specified field index.
QgsFieldConstraints::Constraints fieldConstraints(int fieldIndex) const
Returns any constraints which are present at the provider for a specified field index.
virtual QgsTransaction * transaction() const
Returns the transaction this data provider is included in, if any.
virtual QgsAbstractVectorLayerLabeling * createLabeling(const QVariantMap &configuration=QVariantMap()) const
Creates labeling settings, using provider backend specific information.
static QVariant convertValue(QMetaType::Type type, const QString &value)
Convert value to type.
Qgis::FeatureAvailability hasFeatures() const override
Will always return FeatureAvailability::FeaturesAvailable or FeatureAvailability::NoFeaturesAvailable...
virtual bool renameAttributes(const QgsFieldNameMap &renamedAttributes)
Renames existing attributes.
virtual bool deleteAttributes(const QgsAttributeIds &attributes)
Deletes existing attributes from the provider.
virtual bool skipConstraintCheck(int fieldIndex, QgsFieldConstraints::Constraint constraint, const QVariant &value=QVariant()) const
Returns true if a constraint check should be skipped for a specified field (e.g., if the value return...
virtual Qgis::VectorDataProviderAttributeEditCapabilities attributeEditCapabilities() const
Returns the provider's supported attribute editing capabilities.
bool hasErrors() const
Provider has errors to report.
QgsVectorDataProviderTemporalCapabilities * temporalCapabilities() override
Returns the provider's temporal capabilities.
QString capabilitiesString() const
Returns the above in friendly format.
Represents a vector layer which manages a vector based dataset.
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
static Q_INVOKABLE bool isCurvedType(Qgis::WkbType type)
Returns true if the WKB type is a curved type or can contain curved geometries.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
static Q_INVOKABLE bool isMultiType(Qgis::WkbType type)
Returns true if the WKB type is a multi type.
T qgsgeometry_cast(QgsAbstractGeometry *geom)
QMap< int, QString > QgsFieldNameMap
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
#define QgsDebugMsgLevel(str, level)
#define QgsDebugError(str)
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS_NON_FATAL
#define QGIS_PROTECT_QOBJECT_THREAD_ACCESS
QList< int > QgsAttributeList
QSet< int > QgsAttributeIds
QHash< int, QString > QgsAttrPalIndexNameHash
A bundle of parameters controlling aggregate calculation.
Setting options for creating vector data providers.