Skip to content
Permalink
Browse files

Replace if by switch

  • Loading branch information
pblottiere committed Aug 28, 2017
1 parent b6e42c7 commit f27764d2bae0d59761da99c96bee381d88bf72e3
Showing with 17 additions and 8 deletions.
  1. +17 −8 src/core/qgsvectorlayer.cpp
@@ -2263,17 +2263,26 @@ bool QgsVectorLayer::changeGeometry( QgsFeatureId fid, const QgsGeometry &geom )

bool QgsVectorLayer::changeAttributeValue( QgsFeatureId fid, int field, const QVariant &newValue, const QVariant &oldValue )
{
if ( fields().fieldOrigin( field ) == QgsFields::OriginJoin )
switch ( fields().fieldOrigin( field ) )
{
return mJoinBuffer->changeAttributeValue( fid, field, newValue, oldValue );
}
else
{
if ( !mEditBuffer || !mDataProvider )
case QgsFields::OriginJoin:
return mJoinBuffer->changeAttributeValue( fid, field, newValue, oldValue );

case QgsFields::OriginProvider:
case QgsFields::OriginEdit:
case QgsFields::OriginExpression:
{
if ( !mEditBuffer || !mDataProvider )
return false;
else
return mEditBuffer->changeAttributeValue( fid, field, newValue, oldValue );
}

case QgsFields::OriginUnknown:
return false;
else
return mEditBuffer->changeAttributeValue( fid, field, newValue, oldValue );
}

return false;
}

bool QgsVectorLayer::addAttribute( const QgsField &field )

0 comments on commit f27764d

Please sign in to comment.
You can’t perform that action at this time.