Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Doxygen says no
  • Loading branch information
nyalldawson committed Jun 10, 2021
1 parent 7b19333 commit bb0dfb6
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 74 deletions.
4 changes: 4 additions & 0 deletions python/core/auto_generated/qgsfeature.sip.in
Expand Up @@ -218,6 +218,7 @@ The number of provided attributes need to exactly match the number of the featur
.. seealso:: :py:func:`attributes`
%End


bool setAttribute( int field, const QVariant &attr /GetWrapper/ );
%Docstring
Sets an attribute's value by field index.
Expand Down Expand Up @@ -293,6 +294,7 @@ Resizes the attributes attached to this feature by appending the specified ``cou
.. versionadded:: 3.18
%End


void deleteAttribute( int field );
%Docstring
Deletes an attribute and its value.
Expand Down Expand Up @@ -439,6 +441,7 @@ Returns the field map associated with the feature.
.. seealso:: :py:func:`setFields`
%End


void setAttribute( const QString &name, const QVariant &value /GetWrapper/ );
%Docstring
Insert a value into attribute, by field ``name``.
Expand Down Expand Up @@ -512,6 +515,7 @@ Field map must be associated using setFields()before this method can be used.
}
%End


SIP_PYOBJECT attribute( const QString &name ) const;
%Docstring
Lookup attribute value by attribute ``name``.
Expand Down
5 changes: 5 additions & 0 deletions python/core/auto_generated/qgsfields.sip.in
Expand Up @@ -151,6 +151,7 @@ Returns if a field index is valid
sipRes = new QgsField( sipCpp->operator[]( idx ) );
%End


QgsField at( int i ) const /Factory/;
%Docstring
Returns the field at particular index (must be in range 0..N-1).
Expand All @@ -169,6 +170,7 @@ Returns the field at particular index (must be in range 0..N-1).
}
%End


QgsField field( int fieldIdx ) const /Factory/;
%Docstring
Returns the field at particular index (must be in range 0..N-1).
Expand Down Expand Up @@ -207,6 +209,7 @@ Returns the field with matching name.
}
%End


FieldOrigin fieldOrigin( int fieldIdx ) const;
%Docstring
Returns the field's origin (value from an enumeration).
Expand All @@ -225,6 +228,7 @@ Returns the field's origin (value from an enumeration).
}
%End


int fieldOriginIndex( int fieldIdx ) const;
%Docstring
Returns the field's origin index (its meaning is specific to each type of origin).
Expand Down Expand Up @@ -308,6 +312,7 @@ Utility function to return a list of :py:class:`QgsField` instances
bool operator==( const QgsFields &other ) const;
bool operator!=( const QgsFields &other ) const;


QIcon iconForField( int fieldIdx, bool considerOrigin = false ) const /Factory/;
%Docstring
Returns an icon corresponding to a field index, based on the field's type and source
Expand Down
Expand Up @@ -76,6 +76,7 @@ Applies a ``capitalization`` style to the block's text.
sipRes = sipCpp->size();
%End


const QgsTextFragment &at( int index ) const /Factory/;
%Docstring
Returns the fragment at the specified ``index``.
Expand Down
Expand Up @@ -62,6 +62,7 @@ Appends a ``block`` to the document.
Reserves the specified ``count`` of blocks for optimised block appending.
%End


const QgsTextBlock &at( int index ) const /Factory/;
%Docstring
Returns the block at the specified ``index``.
Expand Down
116 changes: 83 additions & 33 deletions src/core/qgsfeature.h
Expand Up @@ -259,24 +259,32 @@ class CORE_EXPORT QgsFeature
*/
void setAttributes( const QgsAttributes &attrs );

#ifndef SIP_RUN

/**
* Sets an attribute's value by field index.
*
* If the attribute was successfully set then the feature will be automatically marked as valid (see isValid()).
*
* \param field the index of the field to set
* \param attr the value of the attribute
#ifndef SIP_RUN
* \returns FALSE, if the field index does not exist
#else
* \throws KeyError if the field index does not exist
* \note Alternatively in Python: @code feature[field] = attr @endcode
#endif
* \see setAttributes()
*/
#ifndef SIP_RUN
bool setAttribute( int field, const QVariant &attr );
#else

/**
* Sets an attribute's value by field index.
*
* If the attribute was successfully set then the feature will be automatically marked as valid (see isValid()).
*
* \param field the index of the field to set
* \param attr the value of the attribute
* \throws KeyError if the field index does not exist
* \note Alternatively in Python: @code feature[field] = attr @endcode
* \see setAttributes()
*/
bool setAttribute( int field, const QVariant &attr / GetWrapper / );
% MethodCode
bool rv;
Expand Down Expand Up @@ -334,19 +342,28 @@ class CORE_EXPORT QgsFeature
*/
void padAttributes( int count );

#ifndef SIP_RUN

/**
* Deletes an attribute and its value.
*
* \param field the index of the field
*
* \see setAttribute()
*/
void deleteAttribute( int field );
#else

/**
* Deletes an attribute and its value.
*
* \param field the index of the field
*
#ifdef SIP_RUN
* \throws KeyError if the field is not found
* \note Alternatively in Python: @code del feature[field] @endcode
#endif
* \see setAttribute()
*/
void deleteAttribute( int field );
#ifdef SIP_RUN
% MethodCode
if ( a0 >= 0 && a0 < sipCpp->attributes().count() )
sipCpp->deleteAttribute( a0 );
Expand Down Expand Up @@ -465,6 +482,8 @@ class CORE_EXPORT QgsFeature
*/
QgsFields fields() const;

#ifndef SIP_RUN

/**
* Insert a value into attribute, by field \a name.
*
Expand All @@ -476,17 +495,27 @@ class CORE_EXPORT QgsFeature
*
* \param name The name of the field to set
* \param value The value to set
#ifndef SIP_RUN
* \returns FALSE if attribute name could not be converted to index
#else
* \throws KeyError if the attribute name could not be converted to an index
* \note Alternatively in Python: @code feature[name] = attr @endcode
#endif
* \see setFields()
*/
#ifndef SIP_RUN
bool setAttribute( const QString &name, const QVariant &value );
#else

/**
* Insert a value into attribute, by field \a name.
*
* Returns FALSE if field \a name could not be matched.
*
* Field map must be associated using setFields() before this method can be used.
*
* Calling this method will automatically set the feature as valid (see isValid()).
*
* \param name The name of the field to set
* \param value The value to set
* \throws KeyError if the attribute name could not be converted to an index
* \note Alternatively in Python: @code feature[name] = attr @endcode
* \see setFields()
*/
void setAttribute( const QString &name, const QVariant &value / GetWrapper / );
% MethodCode
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
Expand All @@ -509,23 +538,31 @@ class CORE_EXPORT QgsFeature
% End
#endif

#ifndef SIP_RUN

/**
* Removes an attribute value by field \a name.
*
* Field map must be associated using setFields()before this method can be used.
*
* \param name The name of the field to delete
#ifndef SIP_RUN
* \returns FALSE if attribute name could not be converted to index
#else
* \throws KeyError if attribute name could not be converted to index
* \note Alternatively in Python: @code del feature[name] @endcode
#endif
* \see setFields()
*/
bool deleteAttribute( const QString &name );
#ifdef SIP_RUN
#else

/**
* Removes an attribute value by field \a name.
*
* Field map must be associated using setFields()before this method can be used.
*
* \param name The name of the field to delete
* \throws KeyError if attribute name could not be converted to index
* \note Alternatively in Python: @code del feature[name] @endcode
* \see setFields()
*/
bool deleteAttribute( const QString &name );
% MethodCode
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
if ( fieldIdx == -1 )
Expand All @@ -542,24 +579,31 @@ class CORE_EXPORT QgsFeature
% End
#endif

#ifndef SIP_RUN

/**
* Lookup attribute value by attribute \a name.
*
* Field map must be associated using setFields() before this method can be used.
*
* \param name The name of the attribute to get
#ifndef SIP_RUN
* \returns The value of the attribute, or an invalid/null variant if no such name exists
#else
* \see setFields
*/
QVariant attribute( const QString &name ) const;
#else

/**
* Lookup attribute value by attribute \a name.
*
* Field map must be associated using setFields() before this method can be used.
*
* \param name The name of the attribute to get
* \returns The value of the attribute
* \throws KeyError if the field is not found
* \note Alternatively in Python: @code feature[name] @endcode
#endif
* \see setFields
*/
#ifndef SIP_RUN
QVariant attribute( const QString &name ) const;
#else
SIP_PYOBJECT attribute( const QString &name ) const;
% MethodCode
int fieldIdx = sipCpp->fieldNameIndex( *a0 );
Expand All @@ -576,25 +620,31 @@ class CORE_EXPORT QgsFeature
% End
#endif

#ifndef SIP_RUN

/**
* Lookup attribute value from its index.
*
* Field map must be associated using setFields() before this method can be used.
*
* \param fieldIdx The index of the attribute to get
#ifndef SIP_RUN
* \returns The value of the attribute, or an invalid/null variant if no such name exists
#else
* \see setFields()
*/
QVariant attribute( int fieldIdx ) const;
#else

/**
* Lookup attribute value from its index.
*
* Field map must be associated using setFields() before this method can be used.
*
* \param fieldIdx The index of the attribute to get
* \returns The value of the attribute
* \throws KeyError if the field is not found
* \note Alternatively in Python: @code feature[fieldIdx] @endcode
#endif
* \see setFields()
*/
#ifndef SIP_RUN
QVariant attribute( int fieldIdx ) const;
#else
SIP_PYOBJECT attribute( int fieldIdx ) const;
% MethodCode
{
Expand Down

0 comments on commit bb0dfb6

Please sign in to comment.