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,
89 CreateAttributeIndex = 1 << 12,
91 SelectEncoding = 1 << 13,
93 SimplifyGeometries = 1 << 14,
95 SimplifyGeometriesWithTopologicalValidation = 1 << 15,
97 TransactionSupport = 1 << 16
101 const static int EditingCapabilities = AddFeatures | DeleteFeatures |
102 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes;
136 virtual QString storageType()
const;
153 virtual long featureCount()
const = 0;
160 virtual const QgsFields &fields()
const = 0;
166 virtual QString dataComment()
const;
176 virtual QVariant minimumValue(
int index );
186 virtual QVariant maximumValue(
int index );
196 virtual void uniqueValues(
int index, QList<QVariant> &uniqueValues,
int limit = -1 );
204 virtual void enumValues(
int index, QStringList& enumList ) { Q_UNUSED( index ); enumList.clear(); }
224 virtual bool addAttributes(
const QList<QgsField> &attributes );
243 virtual QVariant defaultValue(
int fieldId );
252 virtual bool changeGeometryValues(
QgsGeometryMap & geometry_map );
258 virtual bool createSpatialIndex();
261 virtual bool createAttributeIndex(
int field );
268 virtual int capabilities()
const;
273 QString capabilitiesString()
const;
278 virtual void setEncoding(
const QString& e );
283 QString encoding()
const;
288 int fieldNameIndex(
const QString& fieldName )
const;
293 QMap<QString, int> fieldNameMap()
const;
313 bool supportedType(
const QgsField &field )
const;
317 NativeType( QString typeDesc, QString typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0 ) :
318 mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMinLen( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {};
332 const QList< NativeType > &nativeTypes()
const;
341 static const QStringList &availableEncodings();
356 QStringList errors();
365 static QVariant convertValue( QVariant::Type type, QString value );
373 void clearMinMaxCache();
374 void fillMinMaxCache();
388 void pushError( QString msg );
395 QMap<QString, QVariant::Type> mOldTypeList;
400 static QStringList smEncodings;