Skip to content
Permalink
Browse files
[sipify] rename SIP_PYARGTYPE to SIP_PYTYPE since it can be used to c…
…hanged return types too
  • Loading branch information
3nids committed May 3, 2017
1 parent 75fa28f commit 6958db6f060d103d47876e67b0324894760d7189
Showing with 15 additions and 11 deletions.
  1. +1 −1 cmake_templates/Doxyfile.in
  2. +1 −1 scripts/sipify.pl
  3. +1 −1 src/core/geometry/qgsgeometryutils.h
  4. +2 −2 src/core/qgis.h
  5. +2 −0 tests/scripts/sipifyheader.expected.sip
  6. +8 −6 tests/scripts/sipifyheader.h
@@ -2062,7 +2062,7 @@ EXPAND_AS_DEFINED = "SIP_TRANSFER" \
"SIP_PYNAME" \
"SIP_SKIP" \
"SIP_PYARGDEFAULT" \
"SIP_PYARGTYPE" \
"SIP_PYTYPE" \
"SIP_PYARGREMOVE" \
"SIP_CONVERT_TO_SUBCLASS_CODE" \
"SIP_FEATURE" \
@@ -581,7 +581,7 @@ sub remove_constructor_or_body {
};

# unprinted annotations
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYARGTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
$line =~ s/=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;
# remove argument
if ($line =~ m/SIP_PYARGREMOVE/){
@@ -178,7 +178,7 @@ class CORE_EXPORT QgsGeometryUtils
* @note added in 3.0
*/
static void segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3,
QgsPointSequence SIP_PYARGTYPE( QList<QgsPointV2> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
QgsPointSequence SIP_PYTYPE( QList<QgsPointV2> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle,
bool hasZ = false, bool hasM = false );

@@ -462,9 +462,9 @@ typedef unsigned long long qgssize;
#define SIP_FORCE

/*
* specify an alternative type for SIP argument
* specify an alternative type for SIP argument or return value
*/
#define SIP_PYARGTYPE(type)
#define SIP_PYTYPE(type)

/*
* specify an alternative default value for SIP argument
@@ -315,6 +315,8 @@ remove argument
void position( bool keep, bool keep );
void position( bool keep );

static SIP_PYLIST changeReturnType( QVector<int> *resultTree = 0, QVector<double> &resultCost = 0 );

Whatever &operator[]( int i ) /Factory/;
%MethodCode
....
@@ -50,10 +50,10 @@ typedef qint64 QgsFeatureId;
typedef WhatEver ShouldNotBeDisplayed;
#endif

typedef QSet<QgsFeatureId SIP_PYARGTYPE( qint64 )> QgsFeatureIds;
typedef QMap<QgsFeatureId SIP_PYARGTYPE( qint64 ), QgsAttributeMap SIP_PYARGTYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYARGTYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYARGTYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;
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
@@ -227,10 +227,10 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas

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

void differentType( QList<QgsFeatureId> SIP_PYARGTYPE( QList<qint64> ) & list );
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_PYARGTYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYARGDEFAULT( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );
void complexDefaultValueAndType( QList<QPair<QgsFeatureId SIP_PYTYPE( qint64 ), QMap<int, QString>>> list = QList<QPair<QgsFeatureId, QMap<int, QString>>>() SIP_PYARGDEFAULT( 'QList<QPair<qint64, QMap<int, QString>>>()' ) );

inline int inlineKeyWordShouldNotAppear();

@@ -341,6 +341,8 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
void position( bool keep, bool middle_remove SIP_PYARGREMOVE, bool keep );
void position( bool keep, bool last_remove SIP_PYARGREMOVE );

static void SIP_PYTYPE(SIP_PYLIST) changeReturnType( QVector<int> *resultTree = 0, QVector<double> &resultCost = 0 );

//! Some comment
Whatever &operator[]( int i ) SIP_FACTORY;
#ifdef SIP_RUN

0 comments on commit 6958db6

Please sign in to comment.