32 , mCacheMinMaxDirty( true )
36 setEncoding( settings.value(
"/UI/encoding",
"System" ).toString() );
46 return "Generic vector file";
68 Q_UNUSED( attributes );
74 Q_UNUSED( attributes );
92 Q_UNUSED( geometry_map );
115 QTextCodec* ncodec = QTextCodec::codecForName( e.toLocal8Bit().constData() );
123 mEncoding = QTextCodec::codecForName(
"System" );
126 mEncoding = QTextCodec::codecForLocale();
144 QStringList abilitiesList;
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 )
220 if ( QString::compare( theFields[i].
name(), fieldName, Qt::CaseInsensitive ) == 0 )
230 QMap<QString, int> resultMap;
233 for (
int i = 0; i < theFields.
count(); ++i )
235 resultMap.insert( theFields[i].
name(), i );
254 QgsDebugMsgLevel( QString(
"field name = %1 type = %2 length = %3 precision = %4" )
256 .arg( QVariant::typeToName( field.
type() ) )
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() )
323 QgsDebugMsg(
"Warning: access requested to invalid field index: " + QString::number( index ) );
337 if ( index < 0 || index >=
fields().count() )
339 QgsDebugMsg(
"Warning: access requested to invalid field index: " + QString::number( index ) );
355 keys.append( index );
363 if ( !
set.contains( f.
attribute( index ).toString() ) )
366 set.insert( f.
attribute( index ).toString() );
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 )
411 for ( QgsAttributeList::const_iterator it = keys.begin(); it != keys.end(); ++it )
413 const QVariant& varValue = attrs[*it];
415 if ( varValue.isNull() )
418 if ( flds[*it].type() == QVariant::Int )
420 int value = varValue.toInt();
426 else if ( flds[*it].type() == QVariant::Double )
428 double value = varValue.toDouble();
436 QString value = varValue.toString();
456 if ( !v.convert( type ) || value.isNull() )
457 v = QVariant( type );
464 return s1.toLower() < s2.toLower();
469 if ( smEncodings.isEmpty() )
471 foreach ( QString codec, QTextCodec::availableCodecs() )
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";
537 return !mErrors.isEmpty();
550 QStringList QgsVectorDataProvider::smEncodings;