15#ifndef QGSVECTORDATAPROVIDER_H
16#define QGSVECTORDATAPROVIDER_H
76 DeleteFeatures = 1 << 1,
77 ChangeAttributeValues = 1 << 2,
78 AddAttributes = 1 << 3,
79 DeleteAttributes = 1 << 4,
80 CreateSpatialIndex = 1 << 6,
82 ChangeGeometries = 1 << 8,
83 SelectEncoding = 1 << 13,
84 CreateAttributeIndex = 1 << 12,
85 SimplifyGeometries = 1 << 14,
86 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
87 TransactionSupport = 1 << 16,
88 CircularGeometries = 1 << 17,
89 ChangeFeatures = 1 << 18,
90 RenameAttributes = 1 << 19,
91 FastTruncate = 1 << 20,
92 ReadLayerMetadata = 1 << 21,
93 WriteLayerMetadata = 1 << 22,
94 CancelSupport = 1 << 23,
95 CreateRenderer = 1 << 24,
96 CreateLabeling = 1 << 25,
98 FeatureSymbology = 1 << 27,
101 Q_DECLARE_FLAGS( Capabilities, Capability )
104 static const
int EditingCapabilities = AddFeatures | DeleteFeatures |
105 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes |
140 virtual QString storageType() const;
152 Qgis::WkbType wkbType() const override = 0;
158 long long featureCount() const override = 0;
165 virtual
bool empty() const;
176 virtual
bool isSqlQuery() const;
184 virtual
Qgis::VectorLayerTypeFlags vectorLayerTypeFlags() const;
205 QString sourceName()
const override {
return QString(); }
242 virtual QStringList uniqueStringsMatching(
int index,
const QString &substring,
int limit = -1,
270 virtual void enumValues(
int index, QStringList &enumList
SIP_OUT )
const { Q_UNUSED( index ) enumList.clear(); }
290 virtual bool truncate();
298 virtual bool cancelReload();
305 virtual bool addAttributes(
const QList<QgsField> &attributes );
324 virtual bool renameAttributes(
const QgsFieldNameMap &renamedAttributes );
361 virtual QVariant defaultValue(
int fieldIndex )
const;
370 virtual QString defaultValueClause(
int fieldIndex )
const;
378 QgsFieldConstraints::Constraints fieldConstraints(
int fieldIndex )
const;
396 virtual bool changeGeometryValues(
const QgsGeometryMap &geometry_map );
402 virtual bool createSpatialIndex();
405 virtual bool createAttributeIndex(
int field );
415 Q_INVOKABLE
virtual QgsVectorDataProvider::Capabilities capabilities()
const;
420 QString capabilitiesString()
const;
428 virtual Qgis::VectorDataProviderAttributeEditCapabilities attributeEditCapabilities()
const;
442 virtual void setEncoding(
const QString &e );
449 QString encoding()
const;
454 int fieldNameIndex(
const QString &fieldName )
const;
459 QMap<QString, int> fieldNameMap()
const;
481 bool supportedType( const
QgsField &field ) const;
485 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::Invalid )
486 : mTypeDesc( typeDesc )
491 , mMinPrec( minPrec )
492 , mMaxPrec( maxPrec )
493 , mSubType( subType )
509 QList< QgsVectorDataProvider::NativeType > nativeTypes()
const;
518 static QStringList availableEncodings();
523 bool hasErrors()
const;
533 QStringList errors()
const;
569 static QVariant convertValue( QVariant::Type type, const QString &value );
584 virtual QSet<QgsMapLayerDependency> dependencies()
const;
593 virtual QList<QgsRelation> discoverRelations(
const QgsVectorLayer *target,
const QList<QgsVectorLayer *> &layers )
const;
599 virtual QVariantMap
metadata()
const {
return QVariantMap(); }
614 virtual QString
translateMetadataValue(
const QString &mdKey,
const QVariant &value )
const { Q_UNUSED( mdKey )
return value.toString(); }
643 void raiseError( const QString &msg ) const;
651 void clearMinMaxCache();
656 void fillMinMaxCache() const;
667 void pushError( const QString &msg ) const;
689 QTextCodec *textEncoding() const;
700 mutable
bool mCacheMinMaxDirty = true;
701 mutable QMap<
int, QVariant> mCacheMinValues, mCacheMaxValues;
704 QTextCodec *mEncoding =
nullptr;
713 mutable QStringList mErrors;
717 static QStringList sEncodings;
The Qgis class provides global constants for use throughout the application.
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...
Aggregate
Available aggregates to calculate.
This class represents a coordinate reference system (CRS).
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.
This class 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.
FeatureAvailability
Possible return value for hasFeatures() to determine if a source is empty.
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.
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.
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.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
Implementation of data provider temporal properties for QgsVectorDataProviders.
This is the base class for vector data providers.
virtual void enumValues(int index, QStringList &enumList) const
Returns the possible enum values of an attribute.
Capability
enumeration with capabilities that providers might implement
virtual QString translateMetadataValue(const QString &mdKey, const QVariant &value) const
Gets the translated metadata value.
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
virtual bool hasMetadata() const
Returns true if the data source has metadata, false otherwise.
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 ...
Represents a vector layer which manages a vector based data sets.
QMap< int, QString > QgsFieldNameMap
QMap< QgsFeatureId, QgsGeometry > QgsGeometryMap
QMap< QgsFeatureId, QgsAttributeMap > QgsChangedAttributesMap
QList< QgsFeature > QgsFeatureList
QSet< QgsFeatureId > QgsFeatureIds
QList< int > QgsAttributeList
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
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, QVariant::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0, QVariant::Type subType=QVariant::Invalid)