Skip to content

Commit 51c6c60

Browse files
committedJun 11, 2014
Remove all traces of deprecated QgsFieldMap. Funded by Sourcepole.
1 parent dedc662 commit 51c6c60

File tree

9 files changed

+18
-24
lines changed

9 files changed

+18
-24
lines changed
 

‎src/core/qgsfeature.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ typedef QMap<int, QVariant> QgsAttributeMap;
100100
typedef QVector<QVariant> QgsAttributes;
101101

102102
class QgsField;
103-
typedef QMap<int, QgsField> QgsFieldMap;
104103

105104
#include "qgsfield.h"
106105

‎src/core/qgsfield.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ class CORE_EXPORT QgsField
149149

150150
}; // class QgsField
151151

152-
// key = field index, value=field data
153-
typedef QMap<int, QgsField> QgsFieldMap;
154-
155152

156153
/**
157154
\ingroup core

‎src/core/qgslabel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class QgsLabelAttributes;
4141

4242
typedef QList<int> QgsAttributeList;
4343

44-
typedef QMap<int, QgsField> QgsFieldMap;
4544
class QgsFields;
4645

4746
/** \ingroup core

‎src/core/qgsvectordataprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
150150
/**
151151
* Return a map of indexes with field names for this layer
152152
* @return map of fields
153-
* @see QgsFieldMap
153+
* @see QgsFields
154154
*/
155155
virtual const QgsFields &fields() const = 0;
156156

‎src/core/qgsvectorlayer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3440,10 +3440,10 @@ QString QgsVectorLayer::metadata()
34403440
myMetadata += "</th>";
34413441

34423442
//get info for each field by looping through them
3443-
const QgsFieldMap& myFields = pendingFields();
3444-
for ( QgsFieldMap::const_iterator it = myFields.begin(); it != myFields.end(); ++it )
3443+
const QgsFields& myFields = pendingFields();
3444+
for ( int i = 0, n = myFields.size(); i < n; ++i )
34453445
{
3446-
const QgsField& myField = *it;
3446+
const QgsField& myField = fields[i];
34473447

34483448
myMetadata += "<tr><td>";
34493449
myMetadata += myField.name();

‎src/gui/symbology-ng/qgsrendererv2widget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ void QgsRendererV2DataDefinedMenus::populateMenu( QMenu* menu, QString fieldName
243243

244244
bool hasField = false;
245245
const QgsFields & flds = mLayer->pendingFields();
246-
//const QgsFieldMap& flds = mLayer->pendingFields();
247246
for ( int idx = 0; idx < flds.count(); ++idx )
248247
{
249248
const QgsField& fld = flds[idx];

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2897,7 +2897,7 @@ void QgsGrassModuleInput::updateQgisLayers()
28972897
mMapLayers.push_back( vector );
28982898
mVectorLayerNames.push_back( grassLayer );
28992899

2900-
// convert from QgsFieldMap to std::vector<QgsField>
2900+
// convert from QgsFields to std::vector<QgsField>
29012901
mVectorFields.push_back( vector->dataProvider()->fields() );
29022902
}
29032903
else if ( mType == Raster && layer->type() == QgsMapLayer::RasterLayer )

‎src/providers/mssql/qgsmssqlprovider.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ QGis::WkbType QgsMssqlProvider::getWkbType( QString geometryType, int dim )
14911491

14921492
QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
14931493
const QString& uri,
1494-
const QgsFieldMap &fields,
1494+
const QgsFields &fields,
14951495
QGis::WkbType wkbType,
14961496
const QgsCoordinateReferenceSystem *srs,
14971497
bool overwrite,
@@ -1541,25 +1541,25 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
15411541
{
15421542
int index = 0;
15431543
QString pk = primaryKey = "qgs_fid";
1544-
for ( QgsFieldMap::const_iterator fldIt = fields.begin(); fldIt != fields.end(); ++fldIt )
1544+
for ( int i = 0, n = fields.size(); i < n; ++i )
15451545
{
1546-
if ( fldIt.value().name() == primaryKey )
1546+
if ( fields[i].name() == primaryKey )
15471547
{
15481548
// it already exists, try again with a new name
15491549
primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ );
1550-
fldIt = fields.begin();
1550+
i = 0;
15511551
}
15521552
}
15531553
}
15541554
else
15551555
{
15561556
// search for the passed field
1557-
for ( QgsFieldMap::const_iterator fldIt = fields.begin(); fldIt != fields.end(); ++fldIt )
1557+
for ( int i = 0, n = fields.size(); i < n; ++i )
15581558
{
1559-
if ( fldIt.value().name() == primaryKey )
1559+
if ( fields[i].name() == primaryKey )
15601560
{
15611561
// found, get the field type
1562-
QgsField fld = fldIt.value();
1562+
QgsField fld = fields[i];
15631563
if ( convertField( fld ) )
15641564
{
15651565
primaryKeyType = fld.typeName();
@@ -1688,12 +1688,12 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
16881688

16891689
// get the list of fields
16901690
QList<QgsField> flist;
1691-
for ( QgsFieldMap::const_iterator fldIt = fields.begin(); fldIt != fields.end(); ++fldIt )
1691+
for ( int i = 0, n = fields.size(); i < n; ++i )
16921692
{
1693-
QgsField fld = fldIt.value();
1693+
QgsField fld = fields[i];
16941694
if ( fld.name() == primaryKey )
16951695
{
1696-
oldToNewAttrIdxMap->insert( fldIt.key(), 0 );
1696+
oldToNewAttrIdxMap->insert( fields.indexFromName( fld.name() ), 0 );
16971697
continue;
16981698
}
16991699

@@ -1714,7 +1714,7 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
17141714

17151715
flist.append( fld );
17161716
if ( oldToNewAttrIdxMap )
1717-
oldToNewAttrIdxMap->insert( fldIt.key(), offset++ );
1717+
oldToNewAttrIdxMap->insert( fields.indexFromName( fld.name() ), offset++ );
17181718
}
17191719

17201720
if ( !provider->addAttributes( flist ) )
@@ -1782,7 +1782,7 @@ QGISEXTERN QgsDataItem *dataItem( QString thePath, QgsDataItem *parentItem )
17821782

17831783
QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
17841784
const QString& uri,
1785-
const QgsFieldMap &fields,
1785+
const QgsFields &fields,
17861786
QGis::WkbType wkbType,
17871787
const QgsCoordinateReferenceSystem *srs,
17881788
bool overwrite,

‎src/providers/mssql/qgsmssqlprovider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class QgsMssqlProvider : public QgsVectorDataProvider
231231
/** Import a vector layer into the database */
232232
static QgsVectorLayerImport::ImportError createEmptyLayer(
233233
const QString& uri,
234-
const QgsFieldMap &fields,
234+
const QgsFields &fields,
235235
QGis::WkbType wkbType,
236236
const QgsCoordinateReferenceSystem *srs,
237237
bool overwrite,

0 commit comments

Comments
 (0)
Please sign in to comment.