15 #ifndef QGSVECTORDATAPROVIDER_H 16 #define QGSVECTORDATAPROVIDER_H 68 DeleteFeatures = 1 << 1,
70 ChangeAttributeValues = 1 << 2,
72 AddAttributes = 1 << 3,
74 DeleteAttributes = 1 << 4,
76 SaveAsShapefile = 1 << 5,
78 CreateSpatialIndex = 1 << 6,
82 ChangeGeometries = 1 << 8,
84 SelectGeometryAtId = 1 << 9,
86 RandomSelectGeometryAtId = 1 << 10,
88 SequentialSelectGeometryAtId = 1 << 11,
90 CreateAttributeIndex = 1 << 12,
92 SelectEncoding = 1 << 13,
94 SimplifyGeometries = 1 << 14,
96 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
98 TransactionSupport = 1 << 16,
100 CircularGeometries = 1 << 17,
104 ChangeFeatures = 1 << 18
108 const static int EditingCapabilities = AddFeatures | DeleteFeatures |
109 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes;
143 virtual QString storageType()
const;
160 virtual long featureCount()
const = 0;
167 virtual const QgsFields &fields()
const = 0;
173 virtual QString dataComment()
const;
193 virtual QVariant maximumValue(
int index );
203 virtual void uniqueValues(
int index,
QList<QVariant> &uniqueValues,
int limit = -1 );
261 virtual QVariant defaultValue(
int fieldId );
270 virtual bool changeGeometryValues(
const QgsGeometryMap &geometry_map );
276 virtual bool createSpatialIndex();
279 virtual bool createAttributeIndex(
int field );
286 virtual int capabilities()
const;
291 QString capabilitiesString()
const;
296 virtual void setEncoding(
const QString& e );
306 int fieldNameIndex(
const QString& fieldName )
const;
331 bool supportedType(
const QgsField &field )
const;
335 NativeType(
const QString& typeDesc,
const QString& typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0 ) :
336 mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMinLen( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {}
383 static QVariant convertValue( QVariant::Type type,
const QString& value );
409 void raiseError(
const QString& msg );
412 void clearMinMaxCache();
413 void fillMinMaxCache();
427 void pushError(
const QString& msg );
Wrapper for iterator of features from vector data provider or vector layer.
QgsAttributeList mAttributesToFetch
List of attribute indices to fetch with nextFeature calls.
virtual void enumValues(int index, QStringList &enumList)
Returns the possible enum values of an attribute.
virtual QgsTransaction * transaction() const
Returns the transaction this data provider is included in, if any.
Container of fields for a vector layer.
WkbType
Used for symbology operations.
Abstract base class for spatial data provider implementations.
QList< int > QgsAttributeList
virtual QgsAttributeList pkAttributeIndexes()
Return list of indexes of fields that make up the primary key.
virtual QgsAbstractFeatureSource * featureSource() const
Return feature source object that can be used for querying provider's data.
QSet< int > QgsAttributeIds
QTextCodec * mEncoding
Encoding.
virtual QgsAttrPalIndexNameHash palAttributeIndexNames() const
Return list of indexes to names for QgsPalLabeling fix.
Capability
enumeration with capabilities that providers might implement
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QList< NativeType > mNativeTypes
The names of the providers native types.
Encapsulate a field in an attribute table or data source.
Base class that can be used for any class that is capable of returning features.
virtual bool doesStrictFeatureTypeCheck() const
Returns true if the provider is strict about the type of inserted features (e.g.
This class allows including a set of layers in a database-side transaction, provided the layer data p...
QgsAttrPalIndexNameHash mAttrPalIndexName
Old-style mapping of index to name for QgsPalLabeling fix.
NativeType(const QString &typeDesc, const QString &typeName, QVariant::Type type, int minLen=0, int maxLen=0, int minPrec=0, int maxPrec=0)
virtual void forceReload()
Forces a reload of the underlying datasource if the provider implements this method.
This is the base class for vector data providers.
QHash< int, QString > QgsAttrPalIndexNameHash
QMap< int, QVariant > mCacheMinValues
virtual bool isSaveAndLoadStyleToDBSupported()
It returns false by default.