Merge pull request #8362 from m-kuhn/codeReadability

Improve code readability
This commit is contained in:
Matthias Kuhn 2018-10-30 10:31:20 +01:00 committed by GitHub
commit 2f1dec9824
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -492,10 +492,13 @@ void QgsVectorFileWriter::init( QString vectorFileName,
mFieldValueConverter = fieldValueConverter; mFieldValueConverter = fieldValueConverter;
for ( int fldIdx = 0; ( action == CreateOrOverwriteFile || switch ( action )
action == CreateOrOverwriteLayer || {
action == AppendToLayerAddFields ) && case CreateOrOverwriteFile:
fldIdx < fields.count(); ++fldIdx ) case CreateOrOverwriteLayer:
case AppendToLayerAddFields:
{
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx )
{ {
QgsField attrField = fields.at( fldIdx ); QgsField attrField = fields.at( fldIdx );
@ -674,8 +677,10 @@ void QgsVectorFileWriter::init( QString vectorFileName,
existingIdxs.insert( ogrIdx ); existingIdxs.insert( ogrIdx );
mAttrIdxToOgrIdx.insert( fldIdx, ogrIdx ); mAttrIdxToOgrIdx.insert( fldIdx, ogrIdx );
} }
}
break;
if ( action == AppendToLayerNoNewFields ) case AppendToLayerNoNewFields:
{ {
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx )
{ {
@ -686,6 +691,8 @@ void QgsVectorFileWriter::init( QString vectorFileName,
mAttrIdxToOgrIdx.insert( fldIdx, ogrIdx ); mAttrIdxToOgrIdx.insert( fldIdx, ogrIdx );
} }
} }
break;
}
QgsDebugMsg( QStringLiteral( "Done creating fields" ) ); QgsDebugMsg( QStringLiteral( "Done creating fields" ) );