Skip to content

Commit 6958db6

Browse files
committed
[sipify] rename SIP_PYARGTYPE to SIP_PYTYPE since it can be used to changed return types too
1 parent 75fa28f commit 6958db6

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

cmake_templates/Doxyfile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ EXPAND_AS_DEFINED = "SIP_TRANSFER" \
20622062
"SIP_PYNAME" \
20632063
"SIP_SKIP" \
20642064
"SIP_PYARGDEFAULT" \
2065-
"SIP_PYARGTYPE" \
2065+
"SIP_PYTYPE" \
20662066
"SIP_PYARGREMOVE" \
20672067
"SIP_CONVERT_TO_SUBCLASS_CODE" \
20682068
"SIP_FEATURE" \

scripts/sipify.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ sub remove_constructor_or_body {
581581
};
582582

583583
# unprinted annotations
584-
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYARGTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
584+
$line =~ s/(\w+)(\<(?>[^<>]|(?2))*\>)?\s+SIP_PYTYPE\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/$3/g;
585585
$line =~ s/=\s+[^=]*?\s+SIP_PYARGDEFAULT\(\s*\'?([^()']+)(\(\s*(?:[^()]++|(?2))*\s*\))?\'?\s*\)/= $1/g;
586586
# remove argument
587587
if ($line =~ m/SIP_PYARGREMOVE/){

src/core/geometry/qgsgeometryutils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class CORE_EXPORT QgsGeometryUtils
178178
* @note added in 3.0
179179
*/
180180
static void segmentizeArc( const QgsPointV2 &p1, const QgsPointV2 &p2, const QgsPointV2 &p3,
181-
QgsPointSequence SIP_PYARGTYPE( QList<QgsPointV2> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
181+
QgsPointSequence SIP_PYTYPE( QList<QgsPointV2> ) &points SIP_OUT, double tolerance = M_PI_2 / 90,
182182
QgsAbstractGeometry::SegmentationToleranceType toleranceType = QgsAbstractGeometry::MaximumAngle,
183183
bool hasZ = false, bool hasM = false );
184184

src/core/qgis.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,9 @@ typedef unsigned long long qgssize;
462462
#define SIP_FORCE
463463

464464
/*
465-
* specify an alternative type for SIP argument
465+
* specify an alternative type for SIP argument or return value
466466
*/
467-
#define SIP_PYARGTYPE(type)
467+
#define SIP_PYTYPE(type)
468468

469469
/*
470470
* specify an alternative default value for SIP argument

tests/scripts/sipifyheader.expected.sip

+2
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ remove argument
315315
void position( bool keep, bool keep );
316316
void position( bool keep );
317317

318+
static SIP_PYLIST changeReturnType( QVector<int> *resultTree = 0, QVector<double> &resultCost = 0 );
319+
318320
Whatever &operator[]( int i ) /Factory/;
319321
%MethodCode
320322
....

tests/scripts/sipifyheader.h

+8-6
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ typedef qint64 QgsFeatureId;
5050
typedef WhatEver ShouldNotBeDisplayed;
5151
#endif
5252

53-
typedef QSet<QgsFeatureId SIP_PYARGTYPE( qint64 )> QgsFeatureIds;
54-
typedef QMap<QgsFeatureId SIP_PYARGTYPE( qint64 ), QgsAttributeMap SIP_PYARGTYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
55-
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYARGTYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
56-
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYARGTYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;
53+
typedef QSet<QgsFeatureId SIP_PYTYPE( qint64 )> QgsFeatureIds;
54+
typedef QMap<QgsFeatureId SIP_PYTYPE( qint64 ), QgsAttributeMap SIP_PYTYPE( 'QMap<int, QVariant>' )> QgsChangedAttributesMap;
55+
typedef QMap<QgsFeatureId, QgsAttributeMap> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant> >' ) QgsChangedAttributesMap;
56+
typedef QMap<QgsFeatureId, QPair<QMap<Something, Complex> >> SIP_PYTYPE( 'QMap<qint64, QMap<int, QVariant>>' ) QgsChangedAttributesMap;
5757

5858
/** \ingroup core
5959
* A super QGIS class
@@ -227,10 +227,10 @@ class CORE_EXPORT QgsSipifyHeader : public QtClass<QVariant>, private Ui::QgsBas
227227

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

230-
void differentType( QList<QgsFeatureId> SIP_PYARGTYPE( QList<qint64> ) & list );
230+
void differentType( QList<QgsFeatureId> SIP_PYTYPE( QList<qint64> ) & list );
231231

232232
//! complex default value and type (i.e. containing commas) should be given as a string with single quotes
233-
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>>>()' ) );
233+
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>>>()' ) );
234234

235235
inline int inlineKeyWordShouldNotAppear();
236236

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

344+
static void SIP_PYTYPE(SIP_PYLIST) changeReturnType( QVector<int> *resultTree = 0, QVector<double> &resultCost = 0 );
345+
344346
//! Some comment
345347
Whatever &operator[]( int i ) SIP_FACTORY;
346348
#ifdef SIP_RUN

0 commit comments

Comments
 (0)