Skip to content
Permalink
Browse files
add type and default values identifiers
  • Loading branch information
3nids committed Mar 30, 2017
1 parent 15e4903 commit 9846b34ec3973f6e5bb1238fed60b6d291aa72cf
@@ -293,7 +293,7 @@ class QgsFeature
@note added in QGIS 3.0
%End

void setFields( const QgsFields &fields, bool initAttributes = true );
void setFields( const QgsFields &fields, bool initAttributes = true );
%Docstring
Assign a field map with the feature to allow attribute access by attribute name.
@param fields The attribute fields which this feature holds
@@ -437,6 +437,7 @@ typedef QMap<qint64, QMap<int, QVariant> > QgsChangedAttributesMap;

typedef QMap<qint64, QgsGeometry> QgsGeometryMap;


typedef QSet<qint64> QgsFeatureIds;

typedef QList<QgsFeature> QgsFeatureList;
@@ -287,6 +287,8 @@
$line =~ s/\bSIP_TRANSFERBACK\b/\/TransferBack\//;

$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
$line =~ s/=\s+[^=]*?\s+SIP_PYDEFAULTVALUE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;

# fix astyle placing space after % character
$line =~ s/\s*% (MappedType|TypeHeaderCode|ConvertFromTypeCode|ConvertToTypeCode|MethodCode|End)/%$1/;
@@ -437,3 +437,13 @@ typedef unsigned long long qgssize;
* discard line
*/
#define SIP_SKIP

/**
* specify an alternative type for SIP methods
*/
#define SIP_PYTYPE(type)

/**
* specify an alternative default value for SIP methods
*/
#define SIP_PYDEFAULTVALUE(value)
@@ -352,11 +352,7 @@ class CORE_EXPORT QgsFeature
* @note added in QGIS 2.9
* @see fields
*/
#ifndef SIP_RUN
void setFields( const QgsFields &fields, bool initAttributes = false );
#else
void setFields( const QgsFields &fields, bool initAttributes = true );
#endif
void setFields( const QgsFields &fields, bool initAttributes = false SIP_PYDEFAULTVALUE( true ) );

/** Returns the field map associated with the feature.
* @see setFields
@@ -518,6 +514,7 @@ typedef QMap<QgsFeatureId, QgsGeometry> QgsGeometryMap;
typedef QMap<qint64, QgsGeometry> QgsGeometryMap;
#endif


#ifndef SIP_RUN
typedef QSet<QgsFeatureId> QgsFeatureIds;
#else
@@ -12,6 +12,11 @@

typedef qint64 QgsFeatureId;

typedef QSet<qint64 > QgsFeatureIds;
typedef QMap<qint64 , QMap<int, QVariant>> QgsChangedAttributesMap;
typedef QMap<qint64, QMap<int, QVariant> > QgsChangedAttributesMap;
typedef QMap<qint64, QMap<int, QVariant>> QgsChangedAttributesMap;

typedef QVector<QVariant> QgsSuperClass;

%MappedType QgsSuperClass
@@ -81,6 +86,15 @@ Factory annotation

void setDiagramRenderer( QgsDiagramRenderer *r /Transfer/ );

void differentDefaultValue( bool defaultValue = false , QWidget *parent = 0, QString msg = "hello" );

void differentType( QList<qint64> &list );

void complexDefaultValueAndType( QList<QPair<qint64 , QMap<int, QString>>> list = QList<QPair<qint64, QMap<int, QString>>> );
%Docstring
complex default value and type (i.e. containing commas) should be given as a string with single quotes
%End

inlineKeyWordShouldNotAppear();

QString labelForRange( double lower, double upper ) const /PyName=labelForLowerUpper/;
@@ -40,6 +40,11 @@ typedef qint64 QgsFeatureId;
typedef WhatEver ShouldNotBeDisplayed;
#endif

typedef QSet<QgsFeatureId SIP_PYTYPE( qint64 )> QgsFeatureIds;
typedef QMap<QgsFeatureId SIP_PYTYPE( qint64 ), QgsAttributeMap SIP_PYTYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;

/** \ingroup core
* A super QGIS class
*/
@@ -118,6 +123,13 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private QgsBaseCla

void setDiagramRenderer( QgsDiagramRenderer *r SIP_TRANSFER );

void differentDefaultValue( bool defaultValue = true SIP_PYDEFAULTVALUE( false ), QWidget *parent = nullptr, QString msg = QString() SIP_PYDEFAULTVALUE( "hello" ) );

void differentType( QList<QgsFeatureId> SIP_PYTYPE( QList<qint64> ) &list );

//! complex default value and type (i.e. containing commas) should be given as a string with single quotes
void complexDefaultValueAndType( QList<QPair<QgsFeatureId SIP_PYTYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYDEFAULTVALUE( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );

inline inlineKeyWordShouldNotAppear();

QString labelForRange( double lower, double upper ) const SIP_PYNAME( labelForLowerUpper );

0 comments on commit 9846b34

Please sign in to comment.