18#ifndef QGSATTRIBUTES_H
19#define QGSATTRIBUTES_H
30#include <QExplicitlySharedDataPointer>
39class QgsFeaturePrivate;
48typedef 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();
132 if ( index < 0 || index >= size() )
135 return at( index ).userType() == QMetaType::type(
"QgsUnsetAttributeValue" );
153 % ConvertFromTypeCode
157 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
161 for (
int i = 0; i < sipCpp->size(); ++i )
163 QVariant *v =
new QVariant( sipCpp->at( i ) );
166 if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
174 PyList_SET_ITEM( l, i, tobj );
182 if ( sipIsErr == NULL )
184 if ( !PyList_Check( sipPy ) )
187 for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
188 if ( !sipCanConvertToType( PyList_GET_ITEM( sipPy, i ), sipType_QVariant, SIP_NOT_NONE ) )
195 SIP_SSIZE_T listSize = PyList_GET_SIZE( sipPy );
196 qv->reserve( listSize );
198 for ( SIP_SSIZE_T i = 0; i < listSize; ++i )
200 PyObject *obj = PyList_GET_ITEM( sipPy, i );
201 if ( obj == Py_None )
203 qv->append( QVariant( QVariant::Int ) );
208 QVariant *t =
reinterpret_cast<QVariant *
>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );
212 sipReleaseType( t, sipType_QVariant, state );
219 sipReleaseType( t, sipType_QVariant, state );
225 return sipGetState( sipTransferObj );
bool operator!=(const QgsAttributes &v) const
QgsAttributes(int size)
Create a new vector of attributes with the given size.
bool isUnsetValue(int index) const
Returns true if the attribute at the specified index is an unset value.
QgsAttributes(int size, const QVariant &v)
Constructs a vector with an initial size of size elements.
bool operator==(const QgsAttributes &v) const
Compares two vectors of attributes.
QgsAttributes()=default
Constructor for QgsAttributes.
QgsAttributes(const QVector< QVariant > &v)
Copies another vector of attributes.
CORE_EXPORT QgsAttributeMap toMap() const
Returns a QgsAttributeMap of the attribute values.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
A rectangle specified with double values.
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
CORE_EXPORT uint qHash(const QgsAttributes &attributes)
Hash for QgsAttributes.
QMap< int, QString > QgsFieldNameMap
QMap< int, QVariant > QgsAttributeMap