77 int originIndex = -1 ;
103 bool append(
const QgsField &field, FieldOrigin origin = OriginProvider,
int originIndex = -1 );
109 bool rename(
int fieldIdx,
const QString &name );
112 bool appendExpressionField(
const QgsField &field,
int originIndex );
119 void remove(
int fieldIdx );
127 void remove(
int fieldIdx );
129 if ( a0 < 0 || a0 >= sipCpp->count() )
131 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
136 sipCpp->remove( a0 );
145 bool isEmpty()
const;
153 sipRes = sipCpp->count();
157 int __bool__()
const;
169 QStringList names()
const;
176 bool exists(
int i )
const;
187 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->count() );
191 sipRes =
new QgsField( sipCpp->operator[]( idx ) );
198 const int fieldIdx = sipCpp->lookupField( *a0 );
199 if ( fieldIdx == -1 )
201 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
206 sipRes = sipConvertFromType(
new QgsField( sipCpp->at( fieldIdx ) ), sipType_QgsField, Py_None );
225 if ( a0 < 0 || a0 >= sipCpp->count() )
227 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
232 sipRes =
new QgsField( sipCpp->at( a0 ) );
251 if ( a0 < 0 || a0 >= sipCpp->count() )
253 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
258 sipRes =
new QgsField( sipCpp->field( a0 ) );
277 int fieldIdx = sipCpp->indexFromName( *a0 );
278 if ( fieldIdx == -1 )
280 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
285 sipRes =
new QgsField( sipCpp->field( *a0 ) );
295 FieldOrigin fieldOrigin(
int fieldIdx )
const;
303 FieldOrigin fieldOrigin(
int fieldIdx )
const;
305 if ( a0 < 0 || a0 >= sipCpp->count() )
307 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
312 sipRes = sipCpp->fieldOrigin( a0 );
322 int fieldOriginIndex(
int fieldIdx )
const;
330 int fieldOriginIndex(
int fieldIdx )
const;
332 if ( a0 < 0 || a0 >= sipCpp->count() )
334 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
339 sipRes = sipCpp->fieldOriginIndex( a0 );
357 int indexFromName(
const QString &fieldName )
const;
370 int indexOf(
const QString &fieldName )
const;
385 int lookupField(
const QString &fieldName )
const;
393 QList<QgsField> toList()
const;
405 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
414 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
416 if ( a0 < 0 || a0 >= sipCpp->count() )
418 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
423 sipRes =
new QIcon( sipCpp->iconForField( a0 ) );
436 static QIcon iconForFieldType( QVariant::Type type, QVariant::Type subType = QVariant::Type::Invalid,
const QString &typeString = QString() );
439 operator QVariant()
const
441 return QVariant::fromValue( *
this );
446 void __setitem__(
int key,
const QgsField &field );
448 int idx = ( int )sipConvertFromSequenceIndex( a0, sipCpp->count() );
452 ( *sipCpp )[idx] = *a1;
461 class const_iterator;
467 typedef std::random_access_iterator_tag iterator_category;
468 typedef qptrdiff difference_type;
479 inline QgsField &operator[]( difference_type j )
const {
return d[j].
field; }
480 inline bool operator==(
const iterator &o )
const noexcept {
return d == o.d; }
481 inline bool operator!=(
const iterator &o )
const noexcept {
return d != o.d; }
482 inline bool operator<(
const iterator &other )
const noexcept {
return d < other.d; }
483 inline bool operator<=(
const iterator &other )
const noexcept {
return d <= other.d; }
484 inline bool operator>(
const iterator &other )
const noexcept {
return d > other.d; }
485 inline bool operator>=(
const iterator &other )
const noexcept {
return d >= other.d; }
487 inline iterator &operator++() { ++d;
return *
this; }
488 inline iterator operator++(
int ) {
QgsFields::Field *n = d; ++d;
return n; }
489 inline iterator &operator--() { d--;
return *
this; }
490 inline iterator operator--(
int ) {
QgsFields::Field *n = d; d--;
return n; }
491 inline iterator &operator+=( difference_type j ) { d += j;
return *
this; }
492 inline iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
493 inline iterator
operator+( difference_type j )
const {
return iterator( d + j ); }
494 inline iterator
operator-( difference_type j )
const {
return iterator( d - j ); }
495 inline int operator-( iterator j )
const {
return int( d - j.d ); }
497 friend class iterator;
504 typedef std::random_access_iterator_tag iterator_category;
505 typedef qptrdiff difference_type;
507 inline const_iterator()
512 inline const_iterator(
const const_iterator &o )
514 inline explicit const_iterator(
const iterator &o )
517 inline const QgsField *operator->()
const {
return &d->
field; }
518 inline const QgsField &operator[]( difference_type j )
const noexcept {
return d[j].
field; }
519 inline bool operator==(
const const_iterator &o )
const noexcept {
return d == o.d; }
520 inline bool operator!=(
const const_iterator &o )
const noexcept {
return d != o.d; }
521 inline bool operator<(
const const_iterator &other )
const noexcept {
return d < other.d; }
522 inline bool operator<=(
const const_iterator &other )
const noexcept {
return d <= other.d; }
523 inline bool operator>(
const const_iterator &other )
const noexcept {
return d > other.d; }
524 inline bool operator>=(
const const_iterator &other )
const noexcept {
return d >= other.d; }
525 inline const_iterator &operator++() { ++d;
return *
this; }
526 inline const_iterator operator++(
int ) {
const QgsFields::Field *n = d; ++d;
return n; }
527 inline const_iterator &operator--() { d--;
return *
this; }
528 inline const_iterator operator--(
int ) {
const QgsFields::Field *n = d; --d;
return n; }
529 inline const_iterator &operator+=( difference_type j ) { d += j;
return *
this; }
530 inline const_iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
531 inline const_iterator
operator+( difference_type j )
const {
return const_iterator( d + j ); }
532 inline const_iterator
operator-( difference_type j )
const {
return const_iterator( d - j ); }
533 inline int operator-( const_iterator j )
const {
return int( d - j.d ); }
535 const_iterator &operator= (
const const_iterator & ) =
delete;
537 friend class const_iterator;
546 const_iterator constBegin() const noexcept;
553 const_iterator constEnd() const noexcept;
560 const_iterator begin() const noexcept;
567 const_iterator end() const noexcept;
588 QSharedDataPointer<QgsFieldsPrivate> d;