15#ifndef QGSVECTORDATAPROVIDER_H
16#define QGSVECTORDATAPROVIDER_H
99 virtual QString storageType()
const;
124 virtual bool empty()
const;
135 virtual bool isSqlQuery()
const;
202 virtual QStringList uniqueStringsMatching(
int index,
const QString &substring,
int limit = -1,
229 virtual void enumValues(
int index, QStringList &enumList
SIP_OUT )
const { Q_UNUSED( index ) enumList.clear(); }
248 virtual bool truncate();
256 virtual bool cancelReload();
263 virtual bool addAttributes(
const QList<QgsField> &attributes );
281 virtual bool renameAttributes(
const QgsFieldNameMap &renamedAttributes );
318 virtual QVariant defaultValue(
int fieldIndex )
const;
326 virtual QString defaultValueClause(
int fieldIndex )
const;
350 virtual bool changeGeometryValues(
const QgsGeometryMap &geometry_map );
356 virtual bool createSpatialIndex();
359 virtual bool createAttributeIndex(
int field );
374 QString capabilitiesString()
const;
396 virtual void setEncoding(
const QString &e );
403 QString encoding()
const;
408 int fieldNameIndex(
const QString &fieldName )
const;
413 QMap<QString, int> fieldNameMap()
const;
430 virtual QString geometryColumnName()
const;
442 bool supportedType( const
QgsField &field ) const;
446 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 )
447 : mTypeDesc( typeDesc )
452 , mMinPrec( minPrec )
453 , mMaxPrec( maxPrec )
454 , mSubType( subType )
446 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 ) {
…}
457 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 )
458 : mTypeDesc( typeDesc )
463 , mMinPrec( minPrec )
464 , mMaxPrec( maxPrec )
457 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 ) {
…}
482 QList< QgsVectorDataProvider::NativeType > nativeTypes()
const;
491 static QStringList availableEncodings();
496 bool hasErrors()
const;
506 QStringList errors()
const;
545 static QVariant convertValue( QMetaType::Type type, const QString &value );
552 Q_DECL_DEPRECATED static QVariant convertValue( QVariant::Type type, const QString &value )
SIP_DEPRECATED;
567 virtual QSet<QgsMapLayerDependency> dependencies()
const;
575 virtual QList<QgsRelation> discoverRelations(
const QgsVectorLayer *target,
const QList<QgsVectorLayer *> &layers )
const;
581 virtual QVariantMap
metadata()
const {
return QVariantMap(); }
596 virtual QString
translateMetadataValue(
const QString &mdKey,
const QVariant &value )
const { Q_UNUSED( mdKey )
return value.toString(); }
626 void raiseError( const QString &msg ) const;
634 void clearMinMaxCache();
639 void fillMinMaxCache() const;
649 void pushError( const QString &msg ) const;
671 QTextCodec *textEncoding()
const;
683 mutable bool mCacheMinMaxDirty =
true;
684 mutable QMap<int, QVariant> mCacheMinValues, mCacheMaxValues;
687 QTextCodec *mEncoding =
nullptr;
693 QList< NativeType > mNativeTypes;
696 mutable QStringList mErrors;
698 std::unique_ptr< QgsVectorDataProviderTemporalCapabilities > mTemporalCapabilities;
699 std::unique_ptr< QgsDataProviderElevationProperties > mElevationProperties;
701 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.
Abstract base class for spatial data provider implementations.
virtual QString dataComment() const
Returns a short comment for the data that this provider is providing access to (e....
virtual QgsDataProviderTemporalCapabilities * temporalCapabilities()
Returns the provider's temporal capabilities.
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.
virtual void enumValues(int index, QStringList &enumList) const
Returns the possible enum values of an attribute.
QString sourceName() const override
Returns a friendly display name for the source.
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 bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
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.
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.
virtual QString translateMetadataKey(const QString &mdKey) const
Gets the translated metadata key.
virtual QVariantMap metadata() const
Gets metadata, dependent on the provider type, that will be display in the metadata tab of the layer ...
Stores queued vector layer edit operations prior to committing changes to the layer's data provider.
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
const QgsAttributeList & attributeIndexes
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)