[sipify] rename SIP_PYARGTYPE to SIP_PYTYPE since it can be used to changed return types too

This commit is contained in:
Denis Rouzaud 2017-05-03 07:22:30 +02:00
parent 75fa28f5f3
commit 6958db6f06
6 changed files with 15 additions and 11 deletions

View File

@ -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" \

View File

@ -581,7 +581,7 @@ while ($line_idx < $line_count){
};
# 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/){

View File

@ -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 );

View File

@ -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

View File

@ -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
....

View File

@ -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