QGIS API Documentation  2.12.0-Lyon
qgsfeature_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfeature_p.h
3  ---------------
4 Date : May-2015
5 Copyright : (C) 2015 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSFEATURE_PRIVATE_H
17 #define QGSFEATURE_PRIVATE_H
18 
20 
21 //
22 // W A R N I N G
23 // -------------
24 //
25 // This file is not part of the QGIS API. It exists purely as an
26 // implementation detail. This header file may change from version to
27 // version without notice, or even be removed.
28 //
29 
30 #include "qgsfield.h"
31 
32 #include "qgsgeometry.h"
33 
34 class QgsFeaturePrivate : public QSharedData
35 {
36  public:
37 
38  explicit QgsFeaturePrivate( QgsFeatureId id )
39  : fid( id )
40  , geometry( 0 )
41  , ownsGeometry( false )
42  , valid( false )
43  {
44  }
45 
46  QgsFeaturePrivate( const QgsFeaturePrivate& other )
47  : QSharedData( other )
48  , fid( other.fid )
49  , attributes( other.attributes )
50  , geometry( other.ownsGeometry && other.geometry ? new QgsGeometry( *other.geometry ) : other.geometry )
51  , ownsGeometry( other.ownsGeometry )
52  , valid( other.valid )
53  , fields( other.fields )
54  {
55  }
56 
57  ~QgsFeaturePrivate()
58  {
59  if ( ownsGeometry )
60  delete geometry;
61  }
62 
64  QgsFeatureId fid;
65 
67  QgsAttributes attributes;
68 
73  QgsGeometry *geometry;
74 
78  bool ownsGeometry;
79 
81  bool valid;
82 
84  QgsFields fields;
85 
86 };
87 
89 
90 #endif //QGSFEATURE_PRIVATE_H
Container of fields for a vector layer.
Definition: qgsfield.h:177
A geometry is the spatial representation of a feature.
Definition: qgsgeometry.h:76
qint64 QgsFeatureId
Definition: qgsfeature.h:31
A vector of attributes.
Definition: qgsfeature.h:109