15 #ifndef QGSVECTORDATAPROVIDER_H
16 #define QGSVECTORDATAPROVIDER_H
65 DeleteFeatures = 1 << 1,
67 ChangeAttributeValues = 1 << 2,
69 AddAttributes = 1 << 3,
71 DeleteAttributes = 1 << 4,
73 SaveAsShapefile = 1 << 5,
75 CreateSpatialIndex = 1 << 6,
79 ChangeGeometries = 1 << 8,
81 SelectGeometryAtId = 1 << 9,
83 RandomSelectGeometryAtId = 1 << 10,
85 SequentialSelectGeometryAtId = 1 << 11,
86 CreateAttributeIndex = 1 << 12,
88 SelectEncoding = 1 << 13,
90 SimplifyGeometries = 1 << 14,
92 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
96 const static int EditingCapabilities = AddFeatures | DeleteFeatures |
97 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes;
131 virtual QString storageType()
const;
148 virtual long featureCount()
const = 0;
155 virtual const QgsFields &fields()
const = 0;
161 virtual QString dataComment()
const;
171 virtual QVariant minimumValue(
int index );
181 virtual QVariant maximumValue(
int index );
191 virtual void uniqueValues(
int index, QList<QVariant> &uniqueValues,
int limit = -1 );
199 virtual void enumValues(
int index, QStringList& enumList ) { Q_UNUSED( index ); enumList.clear(); }
219 virtual bool addAttributes(
const QList<QgsField> &attributes );
238 virtual QVariant defaultValue(
int fieldId );
247 virtual bool changeGeometryValues(
QgsGeometryMap & geometry_map );
253 virtual bool createSpatialIndex();
256 virtual bool createAttributeIndex(
int field );
263 virtual int capabilities()
const;
268 QString capabilitiesString()
const;
273 virtual void setEncoding(
const QString& e );
278 QString encoding()
const;
283 int fieldNameIndex(
const QString& fieldName )
const;
288 QMap<QString, int> fieldNameMap()
const;
308 bool supportedType(
const QgsField &field )
const;
312 NativeType( QString typeDesc, QString typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0 ) :
313 mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMinLen( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {};
327 const QList< NativeType > &nativeTypes()
const;
335 static const QStringList &availableEncodings();
350 QStringList errors();
359 static QVariant convertValue( QVariant::Type type, QString value );
362 void clearMinMaxCache();
363 void fillMinMaxCache();
383 void pushError( QString msg );
390 QMap<QString, QVariant::Type> mOldTypeList;
395 static QStringList smEncodings;