Skip to content

Commit

Permalink
Add overload for QgsFeature with QgsFields
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Mar 30, 2013
1 parent bd373fd commit fe59da5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions python/core/qgsfeature.sip
Expand Up @@ -90,6 +90,8 @@ class QgsFeature
//! Constructor
QgsFeature( qint64 id = 0 );

QgsFeature( const QgsFields& fields, qint64 id = 0 );

/** copy ctor needed due to internal pointer */
QgsFeature( const QgsFeature & rhs );

Expand Down
10 changes: 10 additions & 0 deletions src/core/qgsfeature.cpp
Expand Up @@ -37,6 +37,16 @@ QgsFeature::QgsFeature( QgsFeatureId id )
// NOOP
}

QgsFeature::QgsFeature( const QgsFields &fields, QgsFeatureId id )
: mFid( id )
, mGeometry( 0 )
, mOwnsGeometry( 0 )
, mValid( false )
, mFields( &fields )
{
initAttributes( fields.count() );
}

QgsFeature::QgsFeature( QgsFeature const & rhs )
: mFid( rhs.mFid )
, mAttributes( rhs.mAttributes )
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsfeature.h
Expand Up @@ -117,6 +117,8 @@ class CORE_EXPORT QgsFeature
//! Constructor
QgsFeature( QgsFeatureId id = QgsFeatureId() );

QgsFeature( const QgsFields& fields, QgsFeatureId id = QgsFeatureId() );

/** copy ctor needed due to internal pointer */
QgsFeature( const QgsFeature & rhs );

Expand Down

0 comments on commit fe59da5

Please sign in to comment.