Skip to content

Commit

Permalink
Replace deprecated sipMappedType with sipTypeDef
Browse files Browse the repository at this point in the history
  • Loading branch information
mitya57 authored and nyalldawson committed Jul 21, 2020
1 parent 23f0e01 commit ae8b427
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
12 changes: 6 additions & 6 deletions python/core/auto_generated/geometry/qgsgeometry.sip.in
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ is null, a ValueError will be raised.
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QgsPointXY>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QgsPointXY>" );
sipRes = sipConvertFromNewType( new QVector< QgsPointXY >( sipCpp->randomPointsInPolygon( a0, a1 ) ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QVector< QgsPointXY >( sipCpp->randomPointsInPolygon( a0, a1 ) ), qvector_type, Py_None );
} }
%End %End
Expand Down Expand Up @@ -1681,7 +1681,7 @@ will be raised.
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector< QgsPointXY >" ); const sipTypeDef *qvector_type = sipFindType( "QVector< QgsPointXY >" );
sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asPolyline() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asPolyline() ), qvector_type, Py_None );
} }
%End %End
Expand Down Expand Up @@ -1712,7 +1712,7 @@ will be raised.
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QVector<QgsPointXY>>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QgsPointXY>>" );
sipRes = sipConvertFromNewType( new QgsPolygonXY( sipCpp->asPolygon() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsPolygonXY( sipCpp->asPolygon() ), qvector_type, Py_None );
} }
%End %End
Expand Down Expand Up @@ -1742,7 +1742,7 @@ will be raised.
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector< QgsPointXY >" ); const sipTypeDef *qvector_type = sipFindType( "QVector< QgsPointXY >" );
sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asMultiPoint() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asMultiPoint() ), qvector_type, Py_None );
} }
%End %End
Expand Down Expand Up @@ -1773,7 +1773,7 @@ will be raised.
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QVector<QgsPointXY>>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QgsPointXY>>" );
sipRes = sipConvertFromNewType( new QgsMultiPolylineXY( sipCpp->asMultiPolyline() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsMultiPolylineXY( sipCpp->asMultiPolyline() ), qvector_type, Py_None );
} }
%End %End
Expand Down Expand Up @@ -1804,7 +1804,7 @@ will be raised.
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QVector<QVector<QgsPointXY>>>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QVector<QgsPointXY>>>" );
sipRes = sipConvertFromNewType( new QgsMultiPolygonXY( sipCpp->asMultiPolygon() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsMultiPolygonXY( sipCpp->asMultiPolygon() ), qvector_type, Py_None );
} }
%End %End
Expand Down
44 changes: 22 additions & 22 deletions python/core/conversions.sip
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ template <TYPE>
if ((l = PyList_New(sipCpp->size())) == NULL) if ((l = PyList_New(sipCpp->size())) == NULL)
return NULL; return NULL;


const sipMappedType *qvector_type = sipFindMappedType("QVector<TYPE>"); const sipTypeDef *qvector_type = sipFindType("QVector<TYPE>");


// Set the list elements. // Set the list elements.
for (int i = 0; i < sipCpp->size(); ++i) for (int i = 0; i < sipCpp->size(); ++i)
Expand All @@ -62,7 +62,7 @@ template <TYPE>
%End %End


%ConvertToTypeCode %ConvertToTypeCode
const sipMappedType *qvector_type = sipFindMappedType("QVector<TYPE>"); const sipTypeDef *qvector_type = sipFindType("QVector<TYPE>");


// Check the type if that is all that is required. // Check the type if that is all that is required.
if (sipIsErr == NULL) if (sipIsErr == NULL)
Expand All @@ -71,7 +71,7 @@ template <TYPE>
return 0; return 0;


for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
if (!sipCanConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_type, SIP_NOT_NONE)) if (!sipCanConvertToType(PyList_GET_ITEM(sipPy, i), qvector_type, SIP_NOT_NONE))
return 0; return 0;


return 1; return 1;
Expand All @@ -84,16 +84,16 @@ template <TYPE>
{ {
int state; int state;
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); //TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QVector<TYPE> *t = reinterpret_cast< QVector<TYPE> * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); QVector<TYPE> *t = reinterpret_cast< QVector<TYPE> * >(sipConvertToType(PyList_GET_ITEM(sipPy, i), qvector_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));


if (*sipIsErr) if (*sipIsErr)
{ {
sipReleaseMappedType(t, qvector_type, state); sipReleaseType(t, qvector_type, state);
delete ql; delete ql;
return 0; return 0;
} }
ql->append(*t); ql->append(*t);
sipReleaseMappedType(t, qvector_type, state); sipReleaseType(t, qvector_type, state);
} }


*sipCppPtr = ql; *sipCppPtr = ql;
Expand All @@ -118,7 +118,7 @@ template <TYPE>
if ((l = PyList_New(sipCpp->size())) == NULL) if ((l = PyList_New(sipCpp->size())) == NULL)
return NULL; return NULL;


const sipMappedType *qvector_type = sipFindMappedType("QVector<QVector<TYPE> >"); const sipTypeDef *qvector_type = sipFindType("QVector<QVector<TYPE> >");


// Set the list elements. // Set the list elements.
for (int i = 0; i < sipCpp->size(); ++i) for (int i = 0; i < sipCpp->size(); ++i)
Expand All @@ -139,7 +139,7 @@ template <TYPE>


%ConvertToTypeCode %ConvertToTypeCode


const sipMappedType *qvector_type = sipFindMappedType("QVector<QVector<TYPE> >"); const sipTypeDef *qvector_type = sipFindType("QVector<QVector<TYPE> >");


// Check the type if that is all that is required. // Check the type if that is all that is required.
if (sipIsErr == NULL) if (sipIsErr == NULL)
Expand All @@ -148,7 +148,7 @@ template <TYPE>
return 0; return 0;


for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
if (!sipCanConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_type, SIP_NOT_NONE)) if (!sipCanConvertToType(PyList_GET_ITEM(sipPy, i), qvector_type, SIP_NOT_NONE))
return 0; return 0;


return 1; return 1;
Expand All @@ -161,16 +161,16 @@ template <TYPE>
{ {
int state; int state;
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); //TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QVector<QVector<TYPE> > *t = reinterpret_cast< QVector< QVector<TYPE> > * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); QVector<QVector<TYPE> > *t = reinterpret_cast< QVector< QVector<TYPE> > * >(sipConvertToType(PyList_GET_ITEM(sipPy, i), qvector_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));


if (*sipIsErr) if (*sipIsErr)
{ {
sipReleaseMappedType(t, qvector_type, state); sipReleaseType(t, qvector_type, state);
delete ql; delete ql;
return 0; return 0;
} }
ql->append(*t); ql->append(*t);
sipReleaseMappedType(t, qvector_type, state); sipReleaseType(t, qvector_type, state);
} }


*sipCppPtr = ql; *sipCppPtr = ql;
Expand All @@ -194,7 +194,7 @@ template <TYPE>
if ((l = PyList_New(sipCpp->size())) == NULL) if ((l = PyList_New(sipCpp->size())) == NULL)
return NULL; return NULL;


const sipMappedType *qlist_type = sipFindMappedType("QList<TYPE>"); const sipTypeDef *qlist_type = sipFindType("QList<TYPE>");


// Set the list elements. // Set the list elements.
for (int i = 0; i < sipCpp->size(); ++i) for (int i = 0; i < sipCpp->size(); ++i)
Expand All @@ -215,7 +215,7 @@ template <TYPE>
%End %End


%ConvertToTypeCode %ConvertToTypeCode
const sipMappedType *qlist_type = sipFindMappedType("QList<TYPE>"); const sipTypeDef *qlist_type = sipFindType("QList<TYPE>");


// Check the type if that is all that is required. // Check the type if that is all that is required.
if (sipIsErr == NULL) if (sipIsErr == NULL)
Expand All @@ -224,7 +224,7 @@ template <TYPE>
return 0; return 0;


for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
if (!sipCanConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, SIP_NOT_NONE)) if (!sipCanConvertToType(PyList_GET_ITEM(sipPy, i), qlist_type, SIP_NOT_NONE))
return 0; return 0;


return 1; return 1;
Expand All @@ -237,16 +237,16 @@ template <TYPE>
{ {
int state; int state;
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); //TYPE *t = reinterpret_cast<TYPE *>(sipConvertToType(PyList_GET_ITEM(sipPy, i), sipType_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QList<TYPE> *t = reinterpret_cast< QList<TYPE> * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); QList<TYPE> *t = reinterpret_cast< QList<TYPE> * >(sipConvertToType(PyList_GET_ITEM(sipPy, i), qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));


if (*sipIsErr) if (*sipIsErr)
{ {
sipReleaseMappedType(t, qlist_type, state); sipReleaseType(t, qlist_type, state);
delete ql; delete ql;
return 0; return 0;
} }
ql->append(*t); ql->append(*t);
sipReleaseMappedType(t, qlist_type, state); sipReleaseType(t, qlist_type, state);
} }


*sipCppPtr = ql; *sipCppPtr = ql;
Expand Down Expand Up @@ -462,7 +462,7 @@ template<TYPE>
if ((d = PyDict_New()) == NULL) if ((d = PyDict_New()) == NULL)
return NULL; return NULL;


const sipMappedType *qmap2 = sipFindMappedType("QMap<int, TYPE>"); const sipTypeDef *qmap2 = sipFindType("QMap<int, TYPE>");


// Set the list elements. // Set the list elements.
for (QMap<qint64, QMap<int, TYPE> >::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it) for (QMap<qint64, QMap<int, TYPE> >::iterator it = sipCpp->begin(); it != sipCpp->end(); ++it)
Expand Down Expand Up @@ -531,7 +531,7 @@ template<TYPE>
{ {
qint64 k = PyLong_AsLongLong(kobj); qint64 k = PyLong_AsLongLong(kobj);


// using sipConvertToMappedType to convert directly to QMap<int, TYPE> doesn't work // using sipConvertToType to convert directly to QMap<int, TYPE> doesn't work
// and ends with a segfault // and ends with a segfault


QMap<int, TYPE> qm2; QMap<int, TYPE> qm2;
Expand Down Expand Up @@ -1025,7 +1025,7 @@ template<TYPE2>
Py_ssize_t i = 0; Py_ssize_t i = 0;




const sipMappedType *qlist_type = sipFindMappedType("QList<TYPE2>"); const sipTypeDef *qlist_type = sipFindType("QList<TYPE2>");




// Check the type if that is all that is required. // Check the type if that is all that is required.
Expand All @@ -1051,7 +1051,7 @@ template<TYPE2>


QString *t1 = reinterpret_cast<QString *>(sipConvertToType(t1obj, sipType_QString, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); QString *t1 = reinterpret_cast<QString *>(sipConvertToType(t1obj, sipType_QString, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));


QList<TYPE2> *t2 = reinterpret_cast< QList<TYPE2> * >(sipConvertToMappedType(t2obj, qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr)); QList<TYPE2> *t2 = reinterpret_cast< QList<TYPE2> * >(sipConvertToType(t2obj, qlist_type, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
if (*sipIsErr) if (*sipIsErr)
{ {
sipReleaseType(t2, sipType_TYPE2, state); sipReleaseType(t2, sipType_TYPE2, state);
Expand Down
12 changes: 6 additions & 6 deletions src/core/geometry/qgsgeometry.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1558,7 +1558,7 @@ class CORE_EXPORT QgsGeometry
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QgsPointXY>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QgsPointXY>" );
sipRes = sipConvertFromNewType( new QVector< QgsPointXY >( sipCpp->randomPointsInPolygon( a0, a1 ) ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QVector< QgsPointXY >( sipCpp->randomPointsInPolygon( a0, a1 ) ), qvector_type, Py_None );
} }
% End % End
Expand Down Expand Up @@ -1731,7 +1731,7 @@ class CORE_EXPORT QgsGeometry
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector< QgsPointXY >" ); const sipTypeDef *qvector_type = sipFindType( "QVector< QgsPointXY >" );
sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asPolyline() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asPolyline() ), qvector_type, Py_None );
} }
% End % End
Expand Down Expand Up @@ -1775,7 +1775,7 @@ class CORE_EXPORT QgsGeometry
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QVector<QgsPointXY>>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QgsPointXY>>" );
sipRes = sipConvertFromNewType( new QgsPolygonXY( sipCpp->asPolygon() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsPolygonXY( sipCpp->asPolygon() ), qvector_type, Py_None );
} }
% End % End
Expand Down Expand Up @@ -1817,7 +1817,7 @@ class CORE_EXPORT QgsGeometry
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector< QgsPointXY >" ); const sipTypeDef *qvector_type = sipFindType( "QVector< QgsPointXY >" );
sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asMultiPoint() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsPolylineXY( sipCpp->asMultiPoint() ), qvector_type, Py_None );
} }
% End % End
Expand Down Expand Up @@ -1861,7 +1861,7 @@ class CORE_EXPORT QgsGeometry
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QVector<QgsPointXY>>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QgsPointXY>>" );
sipRes = sipConvertFromNewType( new QgsMultiPolylineXY( sipCpp->asMultiPolyline() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsMultiPolylineXY( sipCpp->asMultiPolyline() ), qvector_type, Py_None );
} }
% End % End
Expand Down Expand Up @@ -1905,7 +1905,7 @@ class CORE_EXPORT QgsGeometry
} }
else else
{ {
const sipMappedType *qvector_type = sipFindMappedType( "QVector<QVector<QVector<QgsPointXY>>>" ); const sipTypeDef *qvector_type = sipFindType( "QVector<QVector<QVector<QgsPointXY>>>" );
sipRes = sipConvertFromNewType( new QgsMultiPolygonXY( sipCpp->asMultiPolygon() ), qvector_type, Py_None ); sipRes = sipConvertFromNewType( new QgsMultiPolygonXY( sipCpp->asMultiPolygon() ), qvector_type, Py_None );
} }
% End % End
Expand Down

0 comments on commit ae8b427

Please sign in to comment.