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();
111 if ( !( ( --i )->isNull() == ( --j )->isNull() && ( i->isNull() || i->type() == j->type() ) && *i == *j ) )
124 inline
bool operator!=( const
QgsAttributes &v )
const {
return !( *
this == v ); }
139 % ConvertFromTypeCode
143 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
147 for (
int i = 0; i < sipCpp->size(); ++i )
149 QVariant *v =
new QVariant( sipCpp->at( i ) );
152 if ( ( tobj = sipConvertFromNewType( v, sipType_QVariant, Py_None ) ) == NULL )
160 PyList_SET_ITEM( l, i, tobj );
168 if ( sipIsErr == NULL )
170 if ( !PyList_Check( sipPy ) )
173 for ( SIP_SSIZE_T i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
174 if ( !sipCanConvertToType( PyList_GET_ITEM( sipPy, i ), sipType_QVariant, SIP_NOT_NONE ) )
181 SIP_SSIZE_T listSize = PyList_GET_SIZE( sipPy );
182 qv->reserve( listSize );
184 for ( SIP_SSIZE_T i = 0; i < listSize; ++i )
186 PyObject *obj = PyList_GET_ITEM( sipPy, i );
187 if ( obj == Py_None )
189 qv->append( QVariant( QVariant::Int ) );
194 QVariant *t =
reinterpret_cast<QVariant *
>( sipConvertToType( obj, sipType_QVariant, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr ) );
198 sipReleaseType( t, sipType_QVariant, state );
205 sipReleaseType( t, sipType_QVariant, state );
211 return sipGetState( sipTransferObj );
217 #endif // QGSATTRIBUTES_H