32 , mCacheMinMaxDirty( true )
46 return "Generic vector file";
68 Q_UNUSED( attributes );
74 Q_UNUSED( attributes );
92 Q_UNUSED( geometry_map );
150 abilitiesList +=
tr(
"Add Features" );
156 abilitiesList +=
tr(
"Delete Features" );
162 abilitiesList +=
tr(
"Change Attribute Values" );
163 QgsDebugMsg(
"Capability: Change Attribute Values" );
168 abilitiesList +=
tr(
"Add Attributes" );
174 abilitiesList +=
tr(
"Delete Attributes" );
181 abilitiesList +=
tr(
"Create Spatial Index" );
187 abilitiesList +=
tr(
"Fast Access to Features at ID" );
193 abilitiesList +=
tr(
"Change Geometries" );
199 abilitiesList +=
tr(
"Simplify Geometries" );
200 QgsDebugMsg(
"Capability: Simplify Geometries before fetch the feature" );
205 abilitiesList +=
tr(
"Simplify Geometries with topological validation" );
206 QgsDebugMsg(
"Capability: Simplify Geometries before fetch the feature ensuring that the result is a valid geometry" );
209 return abilitiesList.
join(
", " );
218 for (
int i = 0; i < theFields.
count(); ++i )
233 for (
int i = 0; i < theFields.
count(); ++i )
261 QgsDebugMsgLevel(
QString(
"native field type = %1 min length = %2 max length = %3 min precision = %4 max precision = %5" )
271 if ( field.
length() == -1 )
321 if ( index < 0 || index >=
fields().count() )
337 if ( index < 0 || index >=
fields().count() )
369 if ( limit >= 0 && values.
size() >= limit )
385 for (
int i = 0; i < flds.
count(); ++i )
387 if ( flds[i].type() == QVariant::Int )
392 else if ( flds[i].type() == QVariant::Double )
418 if ( flds[*it].type() == QVariant::Int )
420 int value = varValue.
toInt();
426 else if ( flds[*it].type() == QVariant::Double )
473 smEncodings << codec;
476 smEncodings <<
"BIG5";
477 smEncodings <<
"BIG5-HKSCS";
478 smEncodings <<
"EUCJP";
479 smEncodings <<
"EUCKR";
480 smEncodings <<
"GB2312";
481 smEncodings <<
"GBK";
482 smEncodings <<
"GB18030";
483 smEncodings <<
"JIS7";
484 smEncodings <<
"SHIFT-JIS";
485 smEncodings <<
"TSCII";
486 smEncodings <<
"UTF-8";
487 smEncodings <<
"UTF-16";
488 smEncodings <<
"KOI8-R";
489 smEncodings <<
"KOI8-U";
490 smEncodings <<
"ISO8859-1";
491 smEncodings <<
"ISO8859-2";
492 smEncodings <<
"ISO8859-3";
493 smEncodings <<
"ISO8859-4";
494 smEncodings <<
"ISO8859-5";
495 smEncodings <<
"ISO8859-6";
496 smEncodings <<
"ISO8859-7";
497 smEncodings <<
"ISO8859-8";
498 smEncodings <<
"ISO8859-8-I";
499 smEncodings <<
"ISO8859-9";
500 smEncodings <<
"ISO8859-10";
501 smEncodings <<
"ISO8859-11";
502 smEncodings <<
"ISO8859-12";
503 smEncodings <<
"ISO8859-13";
504 smEncodings <<
"ISO8859-14";
505 smEncodings <<
"ISO8859-15";
506 smEncodings <<
"IBM 850";
507 smEncodings <<
"IBM 866";
508 smEncodings <<
"CP874";
509 smEncodings <<
"CP1250";
510 smEncodings <<
"CP1251";
511 smEncodings <<
"CP1252";
512 smEncodings <<
"CP1253";
513 smEncodings <<
"CP1254";
514 smEncodings <<
"CP1255";
515 smEncodings <<
"CP1256";
516 smEncodings <<
"CP1257";
517 smEncodings <<
"CP1258";
518 smEncodings <<
"Apple Roman";
519 smEncodings <<
"TIS-620";
520 smEncodings <<
"System";
const QString & name() const
Gets the name of the field.
Wrapper for iterator of features from vector data provider or vector layer.
Supports topological simplification of geometries on provider side according to a distance tolerance...
Allows modification of attribute values.
static QVariant convertValue(QVariant::Type type, const QString &value)
Allows modifications of geometries.
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.
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.
Allows creation of spatial index.
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.
QString join(const QString &separator) const
const_iterator insert(const T &value)
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
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).
Supports simplification of geometries on provider side according to a distance tolerance.
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
Fast access to features using their ID.
int toInt(bool *ok) const
#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 ...
Provider has no capabilities.
bool hasErrors()
Provider has errors to report.
virtual bool changeAttributeValues(const QgsChangedAttributesMap &attr_map)
Changes attribute values of existing features.
Allows deletion of attributes (fields)
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.
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.
QMap< QString, int > fieldNameMap() const
Return a map where the key is the name of the field and the value is its index.
Allows deletion of features.
QgsVectorDataProvider(const QString &uri=QString())
Constructor of the vector provider.
QByteArray toLocal8Bit() const
virtual bool changeGeometryValues(QgsGeometryMap &geometry_map)
Changes geometries of existing features.
bool contains(const T &value) const
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.
double toDouble(bool *ok) const
iterator insert(const Key &key, const T &value)
Allows addition of new attributes (fields)
void pushError(const QString &msg)
bool nextFeature(QgsFeature &f)
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.
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.