32 , mCacheMinMaxDirty( true )
46 return "Generic vector file";
68 Q_UNUSED( attributes );
74 Q_UNUSED( attributes );
92 Q_UNUSED( geometry_map );
100 Q_UNUSED( geometry_map );
158 abilitiesList +=
tr(
"Add Features" );
164 abilitiesList +=
tr(
"Delete Features" );
170 abilitiesList +=
tr(
"Change Attribute Values" );
171 QgsDebugMsg(
"Capability: Change Attribute Values" );
176 abilitiesList +=
tr(
"Add Attributes" );
182 abilitiesList +=
tr(
"Delete Attributes" );
189 abilitiesList +=
tr(
"Create Spatial Index" );
195 abilitiesList +=
tr(
"Fast Access to Features at ID" );
201 abilitiesList +=
tr(
"Change Geometries" );
207 abilitiesList +=
tr(
"Presimplify Geometries" );
208 QgsDebugMsg(
"Capability: Simplify Geometries before fetching the feature" );
213 abilitiesList +=
tr(
"Presimplify Geometries with Validity Check" );
214 QgsDebugMsg(
"Capability: Simplify Geometries before fetch the feature ensuring that the result is a valid geometry" );
219 abilitiesList +=
tr(
"Simultaneous Geometry and Attribute Updates" );
220 QgsDebugMsg(
"Capability: change both feature attributes and geometry at once" );
223 return abilitiesList.
join(
", " );
231 for (
int i = 0; i < theFields.
count(); ++i )
246 for (
int i = 0; i < theFields.
count(); ++i )
274 QgsDebugMsgLevel(
QString(
"native field type = %1 min length = %2 max length = %3 min precision = %4 max precision = %5" )
284 if ( field.
length() == -1 )
334 if ( index < 0 || index >=
fields().count() )
350 if ( index < 0 || index >=
fields().count() )
382 if ( limit >= 0 && values.
size() >= limit )
398 for (
int i = 0; i < flds.
count(); ++i )
400 if ( flds[i].type() == QVariant::Int )
405 else if ( flds[i].type() == QVariant::Double )
431 if ( flds[*it].type() == QVariant::Int )
433 int value = varValue.
toInt();
439 else if ( flds[*it].type() == QVariant::Double )
486 smEncodings << codec;
489 smEncodings <<
"BIG5";
490 smEncodings <<
"BIG5-HKSCS";
491 smEncodings <<
"EUCJP";
492 smEncodings <<
"EUCKR";
493 smEncodings <<
"GB2312";
494 smEncodings <<
"GBK";
495 smEncodings <<
"GB18030";
496 smEncodings <<
"JIS7";
497 smEncodings <<
"SHIFT-JIS";
498 smEncodings <<
"TSCII";
499 smEncodings <<
"UTF-8";
500 smEncodings <<
"UTF-16";
501 smEncodings <<
"KOI8-R";
502 smEncodings <<
"KOI8-U";
503 smEncodings <<
"ISO8859-1";
504 smEncodings <<
"ISO8859-2";
505 smEncodings <<
"ISO8859-3";
506 smEncodings <<
"ISO8859-4";
507 smEncodings <<
"ISO8859-5";
508 smEncodings <<
"ISO8859-6";
509 smEncodings <<
"ISO8859-7";
510 smEncodings <<
"ISO8859-8";
511 smEncodings <<
"ISO8859-8-I";
512 smEncodings <<
"ISO8859-9";
513 smEncodings <<
"ISO8859-10";
514 smEncodings <<
"ISO8859-11";
515 smEncodings <<
"ISO8859-12";
516 smEncodings <<
"ISO8859-13";
517 smEncodings <<
"ISO8859-14";
518 smEncodings <<
"ISO8859-15";
519 smEncodings <<
"IBM 850";
520 smEncodings <<
"IBM 866";
521 smEncodings <<
"CP874";
522 smEncodings <<
"CP1250";
523 smEncodings <<
"CP1251";
524 smEncodings <<
"CP1252";
525 smEncodings <<
"CP1253";
526 smEncodings <<
"CP1254";
527 smEncodings <<
"CP1255";
528 smEncodings <<
"CP1256";
529 smEncodings <<
"CP1257";
530 smEncodings <<
"CP1258";
531 smEncodings <<
"Apple Roman";
532 smEncodings <<
"TIS-620";
533 smEncodings <<
"System";
virtual QSet< QString > layerDependencies() const
Get the list of layer ids on which this layer depends.
Wrapper for iterator of features from vector data provider or vector layer.
static QVariant convertValue(QVariant::Type type, const QString &value)
bool contains(const Key &key) const
virtual QByteArray name() const =0
static bool _compareEncodings(const QString &s1, const QString &s2)
virtual bool addAttributes(const QList< QgsField > &attributes)
Adds new attributes.
QString capabilitiesString() const
Returns the above in friendly format.
Supports simplification of geometries on provider side according to a distance tolerance.
virtual QgsAttributeList attributeIndexes()
Return list of indexes to fetch all attributes in nextFeature()
virtual bool deleteFeatures(const QgsFeatureIds &id)
Deletes one or more features.
virtual void setEncoding(const QString &e)
Set encoding used for accessing data from layer.
int precision() const
Gets the precision of the field.
virtual void uniqueValues(int index, QList< QVariant > &uniqueValues, int limit=-1)
Return unique values of an attribute.
Container of fields for a vector layer.
QStringList errors()
Get recorded errors.
QMap< int, QVariant > mCacheMaxValues
Abstract base class for spatial data provider implementations.
Allows deletion of attributes (fields)
QString join(const QString &separator) const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
int fieldNameIndex(const QString &fieldName) const
Returns the index of a field name or -1 if the field does not exist.
virtual bool addFeatures(QgsFeatureList &flist)
Adds a list of features.
QString tr(const char *sourceText, const char *disambiguation, int n)
QTextCodec * codecForLocale()
virtual QString name() const =0
Return a provider name.
virtual bool createAttributeIndex(int field)
Create an attribute index on the datasource.
static const QStringList & availableEncodings()
Returns a list of available encodings.
QList< Key > keys() const
Allows creation of spatial index.
QString encoding() const
Get encoding which is used for accessing data.
virtual QVariant maximumValue(int index)
Returns the maximum value of an attribute.
virtual bool createSpatialIndex()
Creates a spatial index on the datasource (if supported by the provider type).
QString number(int n, int base)
void append(const T &value)
QTextCodec * mEncoding
Encoding.
bool supportedType(const QgsField &field) const
check if provider supports type of field
int toInt(bool *ok) const
Allows addition of new attributes (fields)
#define QgsDebugMsgLevel(str, level)
virtual QString dataComment() const
Return a short comment for the data that this provider is providing access to (e.g.
QgsAttributes attributes() const
Returns the feature's attributes.
virtual int capabilities() const
Returns a bitmask containing the supported capabilities Note, some capabilities may change depending ...
bool hasErrors()
Provider has errors to report.
QString name() const
Gets the name of the field.
virtual bool changeAttributeValues(const QgsChangedAttributesMap &attr_map)
Changes attribute values of existing features.
virtual bool changeFeatures(const QgsChangedAttributesMap &attr_map, const QgsGeometryMap &geometry_map)
Changes attribute values and geometries of existing features.
const char * constData() const
const QList< NativeType > & nativeTypes() const
Returns the names of the supported types.
virtual QString storageType() const
Returns the permanent storage type for this layer as a friendly name.
static void logMessage(const QString &message, const QString &tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
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.
Allows modifications of geometries.
virtual QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())=0
Query the provider for features specified in request.
void clearErrors()
Clear recorded errors.
int count() const
Return number of items.
Encapsulate a field in an attribute table or data source.
Fast access to features using their ID.
virtual bool changeGeometryValues(const QgsGeometryMap &geometry_map)
Changes geometries of existing features.
QMap< QString, int > fieldNameMap() const
Return a map where the key is the name of the field and the value is its index.
QgsVectorDataProvider(const QString &uri=QString())
Constructor of the vector provider.
QByteArray toLocal8Bit() const
void raiseError(const QString &msg)
Signals an error in this provider.
Supports joint updates for attributes and geometry Providers supporting this should still define Chan...
Supports topological simplification of geometries on provider side according to a distance tolerance...
const char * typeToName(Type typ)
const T & at(int i) const
QVariant value(const QString &key, const QVariant &defaultValue) const
QList< QByteArray > availableCodecs()
virtual const QgsFields & fields() const =0
Return a map of indexes with field names for this layer.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
virtual QVariant defaultValue(int fieldId)
Returns the default value for field specified by fieldId.
virtual QVariant minimumValue(int index)
Returns the minimum value of an attribute.
QTextCodec * codecForName(const QByteArray &name)
int length() const
Gets the length of the field.
virtual ~QgsVectorDataProvider()
Destructor.
virtual bool deleteAttributes(const QgsAttributeIds &attributes)
Deletes existing attributes.
Allows deletion of features.
double toDouble(bool *ok) const
iterator insert(const Key &key, const T &value)
void pushError(const QString &msg)
bool nextFeature(QgsFeature &f)
Provider has no capabilities.
int compare(const QString &other) const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QgsAttributeList allAttributesList() const
Utility function to get list of attribute indexes.
Allows modification of attribute values.
bool isNull(const QVariant &v)
QMap< int, QVariant > mCacheMinValues
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.