18 #ifndef QGSATTRIBUTES_H 19 #define QGSATTRIBUTES_H 21 #include "qgis_core.h" 30 #include <QExplicitlySharedDataPointer> 39 class QgsFeaturePrivate;
48 typedef QMap<int, QgsField> QgsFieldMap;
71 : QVector<QVariant>( size )
80 : QVector<QVariant>( size, v )
88 : QVector<QVariant>( v )
102 if ( size() != v.size() )
104 const QVariant *b = constData();
105 const QVariant *i = b + size();
106 const QVariant *j = v.constData() + size();
108 if ( !( *--i == *--j && i->isNull() == j->isNull() ) )
136 % ConvertFromTypeCode
140 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
144 for (
int i = 0; i < sipCpp->size(); ++i )
146 QVariant *v =
new QVariant( sipCpp->at( i ) );
149 if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
157 PyList_SET_ITEM( l, i, tobj );
165 if ( sipIsErr == NULL )
167 if ( !PyList_Check( sipPy ) )
170 for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
171 if ( !sipCanConvertToType( PyList_GET_ITEM( sipPy, i ), sipType_QVariant, SIP_NOT_NONE ) )
178 SIP_SSIZE_T listSize = PyList_GET_SIZE( sipPy );
179 qv->reserve( listSize );
181 for ( SIP_SSIZE_T i = 0; i < listSize; ++i )
183 PyObject *obj = PyList_GET_ITEM( sipPy, i );
184 if ( obj == Py_None )
186 qv->append( QVariant( QVariant::Int ) );
191 QVariant *t =
reinterpret_cast<QVariant *
>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );
195 sipReleaseType( t, sipType_QVariant, state );
202 sipReleaseType( t, sipType_QVariant, state );
208 return sipGetState( sipTransferObj );
214 #endif // QGSATTRIBUTES_H CORE_EXPORT uint qHash(const QgsAttributes &attributes)
Hash for QgsAttributes.
A rectangle specified with double values.
QgsAttributes(const QVector< QVariant > &v)
Copies another vector of attributes.
A geometry is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QMap< int, QVariant > QgsAttributeMap
QgsAttributes(int size, const QVariant &v)
Constructs a vector with an initial size of size elements.
QgsAttributes(int size)
Create a new vector of attributes with the given size.
QMap< int, QString > QgsFieldNameMap
bool operator!=(const QgsAttributes &v) const
bool operator==(const QgsAttributes &v) const
Compares two vectors of attributes.