18 #ifndef QGSATTRIBUTES_H 19 #define QGSATTRIBUTES_H 21 #include "qgis_core.h" 30 #include <QExplicitlySharedDataPointer> 38 class QgsFeaturePrivate;
47 typedef QMap<int, QgsField> QgsFieldMap;
70 : QVector<QVariant>( size )
79 : QVector<QVariant>( size, v )
87 : QVector<QVariant>( v )
101 if ( size() != v.size() )
103 const QVariant *b = constData();
104 const QVariant *i = b + size();
105 const QVariant *j = v.constData() + size();
107 if ( !( *--i == *--j && i->isNull() == j->isNull() ) )
135 % ConvertFromTypeCode
139 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
143 for (
int i = 0; i < sipCpp->size(); ++i )
145 QVariant *v =
new QVariant( sipCpp->at( i ) );
148 if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
156 PyList_SET_ITEM( l, i, tobj );
164 if ( sipIsErr == NULL )
166 if ( !PyList_Check( sipPy ) )
169 for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
170 if ( !sipCanConvertToType( PyList_GET_ITEM( sipPy, i ), sipType_QVariant, SIP_NOT_NONE ) )
177 SIP_SSIZE_T listSize = PyList_GET_SIZE( sipPy );
178 qv->reserve( listSize );
180 for ( SIP_SSIZE_T i = 0; i < listSize; ++i )
182 PyObject *obj = PyList_GET_ITEM( sipPy, i );
183 if ( obj == Py_None )
185 qv->append( QVariant( QVariant::Int ) );
190 QVariant *t =
reinterpret_cast<QVariant *
>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );
194 sipReleaseType( t, sipType_QVariant, state );
201 sipReleaseType( t, sipType_QVariant, state );
207 return sipGetState( sipTransferObj );
213 #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.
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.