Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1443 from manisandro/qgsfieldmap
Remove all traces of deprecated QgsFieldMap.
  • Loading branch information
NathanW2 committed Jun 12, 2014
2 parents fc8d07e + 51c6c60 commit 28145b4
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 24 deletions.
1 change: 0 additions & 1 deletion src/core/qgsfeature.h
Expand Up @@ -100,7 +100,6 @@ typedef QMap<int, QVariant> QgsAttributeMap;
typedef QVector<QVariant> QgsAttributes;

class QgsField;
typedef QMap<int, QgsField> QgsFieldMap;

#include "qgsfield.h"

Expand Down
3 changes: 0 additions & 3 deletions src/core/qgsfield.h
Expand Up @@ -149,9 +149,6 @@ class CORE_EXPORT QgsField

}; // class QgsField

// key = field index, value=field data
typedef QMap<int, QgsField> QgsFieldMap;


/**
\ingroup core
Expand Down
1 change: 0 additions & 1 deletion src/core/qgslabel.h
Expand Up @@ -41,7 +41,6 @@ class QgsLabelAttributes;

typedef QList<int> QgsAttributeList;

typedef QMap<int, QgsField> QgsFieldMap;
class QgsFields;

/** \ingroup core
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectordataprovider.h
Expand Up @@ -150,7 +150,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
/**
* Return a map of indexes with field names for this layer
* @return map of fields
* @see QgsFieldMap
* @see QgsFields
*/
virtual const QgsFields &fields() const = 0;

Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsvectorlayer.cpp
Expand Up @@ -3440,10 +3440,10 @@ QString QgsVectorLayer::metadata()
myMetadata += "</th>";

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

myMetadata += "<tr><td>";
myMetadata += myField.name();
Expand Down
1 change: 0 additions & 1 deletion src/gui/symbology-ng/qgsrendererv2widget.cpp
Expand Up @@ -243,7 +243,6 @@ void QgsRendererV2DataDefinedMenus::populateMenu( QMenu* menu, QString fieldName

bool hasField = false;
const QgsFields & flds = mLayer->pendingFields();
//const QgsFieldMap& flds = mLayer->pendingFields();
for ( int idx = 0; idx < flds.count(); ++idx )
{
const QgsField& fld = flds[idx];
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -2897,7 +2897,7 @@ void QgsGrassModuleInput::updateQgisLayers()
mMapLayers.push_back( vector );
mVectorLayerNames.push_back( grassLayer );

// convert from QgsFieldMap to std::vector<QgsField>
// convert from QgsFields to std::vector<QgsField>
mVectorFields.push_back( vector->dataProvider()->fields() );
}
else if ( mType == Raster && layer->type() == QgsMapLayer::RasterLayer )
Expand Down
24 changes: 12 additions & 12 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -1491,7 +1491,7 @@ QGis::WkbType QgsMssqlProvider::getWkbType( QString geometryType, int dim )

QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
const QString& uri,
const QgsFieldMap &fields,
const QgsFields &fields,
QGis::WkbType wkbType,
const QgsCoordinateReferenceSystem *srs,
bool overwrite,
Expand Down Expand Up @@ -1541,25 +1541,25 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
{
int index = 0;
QString pk = primaryKey = "qgs_fid";
for ( QgsFieldMap::const_iterator fldIt = fields.begin(); fldIt != fields.end(); ++fldIt )
for ( int i = 0, n = fields.size(); i < n; ++i )
{
if ( fldIt.value().name() == primaryKey )
if ( fields[i].name() == primaryKey )
{
// it already exists, try again with a new name
primaryKey = QString( "%1_%2" ).arg( pk ).arg( index++ );
fldIt = fields.begin();
i = 0;
}
}
}
else
{
// search for the passed field
for ( QgsFieldMap::const_iterator fldIt = fields.begin(); fldIt != fields.end(); ++fldIt )
for ( int i = 0, n = fields.size(); i < n; ++i )
{
if ( fldIt.value().name() == primaryKey )
if ( fields[i].name() == primaryKey )
{
// found, get the field type
QgsField fld = fldIt.value();
QgsField fld = fields[i];
if ( convertField( fld ) )
{
primaryKeyType = fld.typeName();
Expand Down Expand Up @@ -1688,12 +1688,12 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(

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

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

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

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

QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
const QString& uri,
const QgsFieldMap &fields,
const QgsFields &fields,
QGis::WkbType wkbType,
const QgsCoordinateReferenceSystem *srs,
bool overwrite,
Expand Down
2 changes: 1 addition & 1 deletion src/providers/mssql/qgsmssqlprovider.h
Expand Up @@ -231,7 +231,7 @@ class QgsMssqlProvider : public QgsVectorDataProvider
/** Import a vector layer into the database */
static QgsVectorLayerImport::ImportError createEmptyLayer(
const QString& uri,
const QgsFieldMap &fields,
const QgsFields &fields,
QGis::WkbType wkbType,
const QgsCoordinateReferenceSystem *srs,
bool overwrite,
Expand Down

0 comments on commit 28145b4

Please sign in to comment.