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,
92 const static int EditingCapabilities = AddFeatures | DeleteFeatures |
93 ChangeAttributeValues | ChangeGeometries | AddAttributes | DeleteAttributes;
109 virtual QString storageType()
const;
126 virtual long featureCount()
const = 0;
133 virtual const QgsFields &fields()
const = 0;
139 virtual QString dataComment()
const;
149 virtual QVariant minimumValue(
int index );
159 virtual QVariant maximumValue(
int index );
169 virtual void uniqueValues(
int index, QList<QVariant> &uniqueValues,
int limit = -1 );
176 virtual void enumValues(
int index, QStringList& enumList ) { Q_UNUSED( index ); enumList.clear(); }
197 virtual bool addAttributes(
const QList<QgsField> &attributes );
216 virtual QVariant defaultValue(
int fieldId );
225 virtual bool changeGeometryValues(
QgsGeometryMap & geometry_map );
231 virtual bool createSpatialIndex();
234 virtual bool createAttributeIndex(
int field );
241 virtual int capabilities()
const;
246 QString capabilitiesString()
const;
251 virtual void setEncoding(
const QString& e );
256 QString encoding()
const;
261 int fieldNameIndex(
const QString& fieldName )
const;
264 QMap<QString, int> fieldNameMap()
const;
286 bool supportedType(
const QgsField &field )
const;
290 NativeType( QString typeDesc, QString typeName, QVariant::Type type,
int minLen = 0,
int maxLen = 0,
int minPrec = 0,
int maxPrec = 0 ) :
291 mTypeDesc( typeDesc ), mTypeName( typeName ), mType( type ), mMinLen( minLen ), mMaxLen( maxLen ), mMinPrec( minPrec ), mMaxPrec( maxPrec ) {};
306 const QList< NativeType > &nativeTypes()
const;
314 static const QStringList &availableEncodings();
329 QStringList errors();
339 QVariant convertValue( QVariant::Type type, QString value );
341 void clearMinMaxCache();
342 void fillMinMaxCache();
362 void pushError( QString msg );