134 bool rename(
int fieldIdx, const QString &name )
SIP_HOLDGIL;
144 void remove(
int fieldIdx );
155 if ( a0 < 0 || a0 >= sipCpp->count() )
157 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
162 sipCpp->remove( a0 );
181 sipRes = sipCpp->count();
205 Q_INVOKABLE
bool exists(
int i ) const
SIP_HOLDGIL;
209 QgsField operator[](
int i )
const;
217 SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->count() );
221 sipRes =
new QgsField( sipCpp->operator[]( idx ) );
230 const int fieldIdx = sipCpp->lookupField( *a0 );
231 if ( fieldIdx == -1 )
233 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
238 sipRes = sipConvertFromType(
new QgsField( sipCpp->at( fieldIdx ) ), sipType_QgsField, Py_None );
259 if ( a0 < 0 || a0 >= sipCpp->count() )
261 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
266 sipRes =
new QgsField( sipCpp->at( a0 ) );
287 if ( a0 < 0 || a0 >= sipCpp->count() )
289 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
294 sipRes =
new QgsField( sipCpp->field( a0 ) );
305 QgsField field(
const QString &name )
const SIP_FACTORY;
315 int fieldIdx = sipCpp->indexFromName( *a0 );
316 if ( fieldIdx == -1 )
318 PyErr_SetString( PyExc_KeyError, a0->toLatin1() );
323 sipRes =
new QgsField( sipCpp->field( *a0 ) );
345 if ( a0 < 0 || a0 >= sipCpp->count() )
347 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
352 sipRes = sipCpp->fieldOrigin( a0 );
367 int fieldOriginIndex(
int fieldIdx )
const;
380 int fieldOriginIndex(
int fieldIdx )
const SIP_HOLDGIL;
382 if ( a0 < 0 || a0 >= sipCpp->count() )
384 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
389 sipRes = sipCpp->fieldOriginIndex( a0 );
408 Q_INVOKABLE
int indexFromName(
const QString &fieldName )
const SIP_HOLDGIL;
421 Q_INVOKABLE
int indexOf(
const QString &fieldName )
const SIP_HOLDGIL;
436 Q_INVOKABLE
int lookupField(
const QString &fieldName )
const SIP_HOLDGIL;
446 bool operator==( const QgsFields &other ) const
SIP_HOLDGIL;
456 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
466 QIcon iconForField(
int fieldIdx,
bool considerOrigin =
false ) const
SIP_FACTORY;
468 if ( a0 < 0 || a0 >= sipCpp->count() )
470 PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
475 sipRes =
new QIcon( sipCpp->iconForField( a0 ) );
489 static QIcon iconForFieldType( QMetaType::Type type, QMetaType::Type subType = QMetaType::Type::UnknownType,
const QString &typeString = QString() );
500 Q_DECL_DEPRECATED
static QIcon iconForFieldType( QVariant::Type type, QVariant::Type subType,
const QString &typeString = QString() )
SIP_DEPRECATED;
503 operator QVariant()
const
505 return QVariant::fromValue( *
this );
513 int idx = ( int )sipConvertFromSequenceIndex( a0, sipCpp->count() );
517 ( *sipCpp )[idx] = *a1;
527 class const_iterator;
533 typedef std::random_access_iterator_tag iterator_category;
534 typedef qptrdiff difference_type;
544 inline QgsField *operator->()
const {
return &d->
field; }
545 inline QgsField &operator[]( difference_type j )
const {
return d[j].
field; }
546 inline bool operator==(
const iterator &o )
const noexcept {
return d == o.d; }
547 inline bool operator!=(
const iterator &o )
const noexcept {
return d != o.d; }
548 inline bool operator<(
const iterator &other )
const noexcept {
return d < other.d; }
549 inline bool operator<=(
const iterator &other )
const noexcept {
return d <= other.d; }
550 inline bool operator>(
const iterator &other )
const noexcept {
return d > other.d; }
551 inline bool operator>=(
const iterator &other )
const noexcept {
return d >= other.d; }
553 inline iterator &operator++() { ++d;
return *
this; }
554 inline iterator operator++(
int ) {
QgsFields::Field *n = d; ++d;
return n; }
555 inline iterator &operator--() { d--;
return *
this; }
556 inline iterator operator--(
int ) {
QgsFields::Field *n = d; d--;
return n; }
557 inline iterator &operator+=( difference_type j ) { d += j;
return *
this; }
558 inline iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
559 inline iterator
operator+( difference_type j )
const {
return iterator( d + j ); }
560 inline iterator
operator-( difference_type j )
const {
return iterator( d - j ); }
561 inline int operator-( iterator j )
const {
return int( d - j.d ); }
563 friend class iterator;
570 typedef std::random_access_iterator_tag iterator_category;
571 typedef qptrdiff difference_type;
573 inline const_iterator()
578 inline const_iterator(
const const_iterator &o )
580 inline explicit const_iterator(
const iterator &o )
583 inline const QgsField *operator->()
const {
return &d->
field; }
584 inline const QgsField &operator[]( difference_type j )
const noexcept {
return d[j].
field; }
585 inline bool operator==(
const const_iterator &o )
const noexcept {
return d == o.d; }
586 inline bool operator!=(
const const_iterator &o )
const noexcept {
return d != o.d; }
587 inline bool operator<(
const const_iterator &other )
const noexcept {
return d < other.d; }
588 inline bool operator<=(
const const_iterator &other )
const noexcept {
return d <= other.d; }
589 inline bool operator>(
const const_iterator &other )
const noexcept {
return d > other.d; }
590 inline bool operator>=(
const const_iterator &other )
const noexcept {
return d >= other.d; }
591 inline const_iterator &operator++() { ++d;
return *
this; }
592 inline const_iterator operator++(
int ) {
const QgsFields::Field *n = d; ++d;
return n; }
593 inline const_iterator &operator--() { d--;
return *
this; }
594 inline const_iterator operator--(
int ) {
const QgsFields::Field *n = d; --d;
return n; }
595 inline const_iterator &operator+=( difference_type j ) { d += j;
return *
this; }
596 inline const_iterator &operator-=( difference_type j ) { d -= j;
return *
this; }
597 inline const_iterator
operator+( difference_type j )
const {
return const_iterator( d + j ); }
598 inline const_iterator
operator-( difference_type j )
const {
return const_iterator( d - j ); }
599 inline int operator-( const_iterator j )
const {
return int( d - j.d ); }
601 const_iterator &operator= (
const const_iterator & ) =
delete;
603 friend class const_iterator;
612 const_iterator constBegin() const noexcept;
619 const_iterator constEnd() const noexcept;
626 const_iterator begin() const noexcept;
633 const_iterator end() const noexcept;
654 QSharedDataPointer<QgsFieldsPrivate> d;