15#ifndef QGSVECTORDATAPROVIDER_H
16#define QGSVECTORDATAPROVIDER_H
125 virtual bool empty()
const;
203 virtual QStringList uniqueStringsMatching(
int index,
const QString &substring,
int limit = -1,
230 virtual void enumValues(
int index, QStringList &enumList
SIP_OUT )
const { Q_UNUSED( index ) enumList.clear(); }
249 virtual bool truncate();
257 virtual bool cancelReload();
264 virtual bool addAttributes(
const QList<QgsField> &attributes );
282 virtual bool renameAttributes(
const QgsFieldNameMap &renamedAttributes );
319 virtual QVariant defaultValue(
int fieldIndex )
const;
327 virtual QString defaultValueClause(
int fieldIndex )
const;
351 virtual bool changeGeometryValues(
const QgsGeometryMap &geometry_map );
357 virtual bool createSpatialIndex();
360 virtual bool createAttributeIndex(
int field );
375 QString capabilitiesString()
const;
397 virtual void setEncoding(
const QString &e );
404 QString encoding()
const;
409 int fieldNameIndex(
const QString &fieldName )
const;
414 QMap<QString, int> fieldNameMap()
const;
431 virtual QString geometryColumnName()
const;
443 bool supportedType( const
QgsField &field ) const;
447 NativeType(
const QString &typeDesc,
const QString &typeName, QMetaType::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0, QMetaType::Type subType = QMetaType::Type::UnknownType )
458 Q_DECL_DEPRECATED
NativeType(
const QString &typeDesc,
const QString &typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0, QVariant::Type subType = QVariant::Type::Invalid )
483 QList< QgsVectorDataProvider::NativeType >
nativeTypes()
const;
492 static QStringList availableEncodings();
497 bool hasErrors()
const;
507 QStringList errors()
const;
546 static QVariant convertValue( QMetaType::Type type, const QString &value );
553 Q_DECL_DEPRECATED static QVariant convertValue( QVariant::Type type, const QString &value )
SIP_DEPRECATED;
568 virtual QSet<QgsMapLayerDependency> dependencies()
const;
576 virtual QList<QgsRelation> discoverRelations(
const QgsVectorLayer *target,
const QList<QgsVectorLayer *> &layers )
const;
591 virtual QString
translateMetadataValue(
const QString &mdKey,
const QVariant &value )
const { Q_UNUSED( mdKey )
return value.toString(); }
644 void pushError( const QString &msg ) const;
678 mutable bool mCacheMinMaxDirty =
true;
679 mutable QMap<int, QVariant> mCacheMinValues, mCacheMaxValues;
682 QTextCodec *mEncoding =
nullptr;
688 QList< NativeType > mNativeTypes;
691 mutable QStringList mErrors;
693 std::unique_ptr< QgsVectorDataProviderTemporalCapabilities > mTemporalCapabilities;
694 std::unique_ptr< QgsDataProviderElevationProperties > mElevationProperties;
696 static QStringList sEncodings;
@ EditingCapabilities
Bitmask of all editing capabilities.
QFlags< VectorLayerTypeFlag > VectorLayerTypeFlags
Vector layer type flags.
QFlags< DataProviderReadFlag > DataProviderReadFlags
Flags which control data provider construction.
FeatureAvailability
Possible return value for QgsFeatureSource::hasFeatures() to determine if a source is empty.
QFlags< VectorProviderCapability > VectorProviderCapabilities
Vector data provider capabilities.
Aggregate
Available aggregates to calculate.
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.
Base class that can be used for any class that is capable of returning features.
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.
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 QString dataComment() const
Returns a short comment for the data that this provider is providing access to (e....
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.
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
QgsDataSourceUri uri() const
Gets the data source specification.
virtual void reloadData()
Reloads the data from the source for providers with data caches to synchronize, changes in the data s...
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.
Abstract base class for all 2D vector feature renderers.
Wraps a request for features to a vector layer (or directly its vector data provider).
An interface for objects which accept features via addFeature(s) methods.
virtual QString lastError() const
Returns the most recent error encountered by the sink, e.g.
virtual bool addFeatures(QgsFeatureList &features, QgsFeatureSink::Flags flags=QgsFeatureSink::Flags())=0
Adds a list of features to the sink.
An interface for objects which provide features via a getFeatures method.
virtual QgsCoordinateReferenceSystem sourceCrs() const =0
Returns the coordinate reference system for features in the source.
virtual Qgis::FeatureAvailability hasFeatures() const
Determines if there are any features available in the source.
virtual QVariant minimumValue(int fieldIndex) const
Returns the minimum value for an attribute column or an invalid variant in case of error.
virtual QVariant maximumValue(int fieldIndex) const
Returns the maximum value for an attribute column or an invalid variant in case of error.
virtual QgsRectangle sourceExtent() const
Returns the extent of all geometries from the source.
virtual QgsBox3D sourceExtent3D() const
Returns the 3D extent of all geometries from the source.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
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.
A geometry is the spatial representation of a feature.
A rectangle specified with double values.
Allows creation of a multi-layer database-side transaction.
Contains utility functions for working with QVariants and QVariant types.
Implementation of data provider temporal properties for QgsVectorDataProviders.
Base class for vector data providers.
void pushError(const QString &msg) const
Push a notification about errors that happened in this providers scope.
virtual void enumValues(int index, QStringList &enumList) const
Returns the possible enum values of an attribute.
void setNativeTypes(const QList< QgsVectorDataProvider::NativeType > &nativeTypes)
Set the list of native types supported by this provider.
QString sourceName() const override
Returns a friendly display name for the source.
friend class QgsVectorLayerEditBuffer
static const int EditingCapabilities
Bitmask of all provider's editing capabilities.
virtual QString translateMetadataValue(const QString &mdKey, const QVariant &value) const
Gets the translated metadata value.
long long featureCount() const override=0
Number of features in the layer.
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
void clearMinMaxCache()
Invalidates the min/max cache.
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.
virtual bool empty() const
Returns true if the layer does not contain any feature.
QList< QgsVectorDataProvider::NativeType > nativeTypes() const
Returns the names of the supported types.
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
QgsGeometry convertToProviderType(const QgsGeometry &geom) const
Converts the geometry to the provider type if possible / necessary.
virtual QgsAbstractFeatureSource * featureSource() const =0
Returns feature source object that can be used for querying provider's data.
virtual bool hasMetadata() const
Returns true if the data source has metadata, false otherwise.
virtual Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const
Returns the vector layer type flags.
QgsFields fields() const override=0
Returns the fields associated with this data provider.
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.
void fillMinMaxCache() const
Populates the cache of minimum and maximum attribute values.
virtual Q_DECL_DEPRECATED void forceReload()
virtual QString translateMetadataKey(const QString &mdKey) const
Gets the translated metadata key.
Represents a vector layer which manages a vector based dataset.
QMap< int, QString > QgsFieldNameMap
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
QList< int > QgsAttributeList
QList< int > QgsAttributeList
QSet< int > QgsAttributeIds
QHash< int, QString > QgsAttrPalIndexNameHash
A bundle of parameters controlling aggregate calculation.
Setting options for creating vector data providers.
NativeType(const QString &typeDesc, const QString &typeName, QMetaType::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0, QMetaType::Type subType=QMetaType::Type::UnknownType)
Q_DECL_DEPRECATED NativeType(const QString &typeDesc, const QString &typeName, QVariant::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0, QVariant::Type subType=QVariant::Type::Invalid)