Skip to content
Permalink
Browse files
fix #1959
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11773 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 8, 2009
1 parent 669bddf commit e67db9428c6ac94267aeb2ac4a70a695f9e142f0
Showing with 39 additions and 39 deletions.
  1. +39 −39 python/core/conversions.sip
@@ -79,17 +79,17 @@ template <TYPE>
for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
{
int state;
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QVector<TYPE> * t = reinterpret_cast< QVector<TYPE> * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_qgspoint, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t, sipClass_TYPE, state);
sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseInstance(t, sipClass_TYPE, state);
sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
}

*sipCppPtr = ql;
@@ -155,17 +155,17 @@ template <TYPE>
for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
{
int state;
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
//TYPE *t = reinterpret_cast<TYPE *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QVector<QVector<TYPE> > * t = reinterpret_cast< QVector< QVector<TYPE> > * >(sipConvertToMappedType(PyList_GET_ITEM(sipPy, i), qvector_qgspoint, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t, sipClass_TYPE, state);
sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
delete ql;
return 0;
}
ql->append(*t);
sipReleaseInstance(t, sipClass_TYPE, state);
sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
}

*sipCppPtr = ql;
@@ -245,7 +245,7 @@ template <TYPE>
TYPE *t = new TYPE(*it);
PyObject *tobj;

if ((tobj = sipConvertFromNewInstance(t, sipClass_TYPE, sipTransferObj)) == NULL)
if ((tobj = sipConvertFromNewInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj)) == NULL)
{
Py_DECREF(l);
delete t;
@@ -265,7 +265,7 @@ template <TYPE>
return 0;

for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
if (!sipCanConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, SIP_NOT_NONE))
if (!sipCanConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), SIP_NOT_NONE))
return 0;

return 1;
@@ -276,16 +276,16 @@ template <TYPE>
for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
{
int state;
TYPE* t = reinterpret_cast<TYPE *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), sipClass_TYPE, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
TYPE* t = reinterpret_cast<TYPE *>(sipConvertToInstance(PyList_GET_ITEM(sipPy, i), (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t, sipClass_TYPE, state);
sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
delete qset;
return 0;
}
qset->insert(*t);
sipReleaseInstance(t, sipClass_TYPE, state);
sipReleaseInstance(t, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
}

*sipCppPtr = qset;
@@ -366,7 +366,7 @@ template<TYPE>
Py_ssize_t j = 0;
while (PyDict_Next(tobj, &j, &kobj2, &tobj2))
{
if (!sipCanConvertToInstance(tobj2, sipClass_TYPE, SIP_NOT_NONE))
if (!sipCanConvertToInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), SIP_NOT_NONE))
return 0;
}

@@ -393,17 +393,17 @@ template<TYPE>
int k2 = PyInt_AsLong(kobj2);
int state;

TYPE* fa = reinterpret_cast<TYPE*>(sipConvertToInstance(tobj2, sipClass_TYPE, sipTransferObj,SIP_NOT_NONE,&state,sipIsErr));
TYPE* fa = reinterpret_cast<TYPE*>(sipConvertToInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), sipTransferObj,SIP_NOT_NONE,&state,sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(tobj2, sipClass_TYPE, state);
sipReleaseInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
delete qm;
return 0;
}

qm2.insert(k2, *fa);
sipReleaseInstance(tobj2, sipClass_TYPE, state);
sipReleaseInstance(tobj2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE), state);
}
qm->insert(k, qm2);
}
@@ -434,7 +434,7 @@ template<TYPE>
{
QString *t1 = new QString(i.key());

PyObject *t1obj = sipConvertFromNewInstance(t1, sipClass_QString, sipTransferObj);
PyObject *t1obj = sipConvertFromNewInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), sipTransferObj);
PyObject *t2obj = PyInt_FromLong( (long) i.value() );

if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj) < 0)
@@ -480,7 +480,7 @@ template<TYPE>

while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
{
if (!sipCanConvertToInstance(t1obj, sipClass_QString, SIP_NOT_NONE))
if (!sipCanConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), SIP_NOT_NONE))
return 0;
}

@@ -493,19 +493,19 @@ template<TYPE>
{
int state;

QString *t1 = reinterpret_cast<QString *>(sipConvertToInstance(t1obj, sipClass_QString, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QString *t1 = reinterpret_cast<QString *>(sipConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QVariant::Type t2 = (QVariant::Type) PyInt_AsLong(t1obj);

if (*sipIsErr)
{
sipReleaseInstance(t1, sipClass_QString, state);
sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), state);
delete qm;
return 0;
}

qm->insert(*t1, t2);

sipReleaseInstance(t1, sipClass_QString, state);
sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QString), state);
}

*sipCppPtr = qm;
@@ -536,8 +536,8 @@ template<TYPE1, TYPE2>
TYPE1 *t1 = new TYPE1(i.key());
TYPE2 *t2 = i.value();

PyObject *t1obj = sipConvertFromNewInstance(t1, sipClass_TYPE1, sipTransferObj);
PyObject *t2obj = sipConvertFromInstance(t2, sipClass_TYPE2, sipTransferObj);
PyObject *t1obj = sipConvertFromNewInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), sipTransferObj);
PyObject *t2obj = sipConvertFromInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), sipTransferObj);

if (t1obj == NULL || t2obj == NULL || PyDict_SetItem(d, t1obj, t2obj) < 0)
{
@@ -581,10 +581,10 @@ template<TYPE1, TYPE2>

while (PyDict_Next(sipPy, &i, &t1obj, &t2obj))
{
if (!sipCanConvertToInstance(t1obj, sipClass_TYPE1, SIP_NOT_NONE))
if (!sipCanConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), SIP_NOT_NONE))
return 0;

if (!sipCanConvertToInstance(t2obj, sipClass_TYPE2, SIP_NOT_NONE))
if (!sipCanConvertToInstance(t2obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), SIP_NOT_NONE))
return 0;
}

@@ -597,22 +597,22 @@ template<TYPE1, TYPE2>
{
int state1, state2;

TYPE1 *t1 = reinterpret_cast<TYPE1 *>(sipConvertToInstance(t1obj, sipClass_TYPE1, sipTransferObj, SIP_NOT_NONE, &state1, sipIsErr));
TYPE2 *t2 = reinterpret_cast<TYPE2 *>(sipConvertToInstance(t2obj, sipClass_TYPE2, sipTransferObj, SIP_NOT_NONE, &state2, sipIsErr));
TYPE1 *t1 = reinterpret_cast<TYPE1 *>(sipConvertToInstance(t1obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), sipTransferObj, SIP_NOT_NONE, &state1, sipIsErr));
TYPE2 *t2 = reinterpret_cast<TYPE2 *>(sipConvertToInstance(t2obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), sipTransferObj, SIP_NOT_NONE, &state2, sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t1, sipClass_TYPE1, state1);
sipReleaseInstance(t2, sipClass_TYPE2, state2);
sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), state1);
sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2);

delete qm;
return 0;
}

qm->insert(*t1, t2);

sipReleaseInstance(t1, sipClass_TYPE1, state1);
sipReleaseInstance(t2, sipClass_TYPE2, state2);
sipReleaseInstance(t1, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE1), state1);
sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2);
}

*sipCppPtr = qm;
@@ -644,7 +644,7 @@ template<double, TYPE2>
const double t1 = i.key();
TYPE2 * t2 = &i.value();
PyObject *t1obj = PyFloat_FromDouble(t1);
PyObject *t2obj = sipConvertFromInstance(t2, sipClass_TYPE2, sipTransferObj);
PyObject *t2obj = sipConvertFromInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), sipTransferObj);
if (PyDict_GetItem(d, t1obj) == NULL) {
PyObject *lst = PyList_New(0);
PyDict_SetItem(d, t1obj, lst);
@@ -697,7 +697,7 @@ template<double, TYPE2>
{
for (int i = 0; i < PyList_GET_SIZE(t2obj); ++i) {
if (!sipCanConvertToInstance(PyList_GET_ITEM(t2obj, i),
sipClass_TYPE2, SIP_NOT_NONE))
(sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), SIP_NOT_NONE))
return 0;
}
}
@@ -714,23 +714,23 @@ template<double, TYPE2>
TYPE2 *t2 =
reinterpret_cast<TYPE2 *>(sipConvertToInstance(PyList_GET_ITEM(t2obj,
i),
sipClass_TYPE2,
(sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2),
sipTransferObj,
SIP_NOT_NONE,
&state2,
sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t2, sipClass_TYPE2, state2);
sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2);

delete qm;
return 0;
}

qm->insert(k, *t2);

sipReleaseInstance(t2, sipClass_TYPE2, state2);
sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_TYPE2), state2);
}
}

@@ -759,7 +759,7 @@ template<double, TYPE2>
QgsOverlayObject* oobj = new QgsOverlayObject(*it.value());

PyObject* keyobj = PyInt_FromLong(it.key());
PyObject* pyOobj = sipConvertFromInstance(oobj, sipClass_QgsOverlayObject, sipTransferObj);
PyObject* pyOobj = sipConvertFromInstance(oobj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QgsOverlayObject), sipTransferObj);
PyDict_SetItem(d, keyobj, pyOobj);

if(pyOobj == NULL || keyobj == NULL || PyDict_SetItem(d, keyobj, pyOobj) < 0)
@@ -797,18 +797,18 @@ template<double, TYPE2>
{
int state;
int t1 = (int)(PyFloat_AsDouble(t1obj));
QgsOverlayObject* t2 = reinterpret_cast<QgsOverlayObject*>(sipConvertToInstance(t2obj, sipClass_QgsOverlayObject, sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));
QgsOverlayObject* t2 = reinterpret_cast<QgsOverlayObject*>(sipConvertToInstance(t2obj, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QgsOverlayObject), sipTransferObj, SIP_NOT_NONE, &state, sipIsErr));

if (*sipIsErr)
{
sipReleaseInstance(t2, sipClass_QgsOverlayObject, state);
sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QgsOverlayObject), state);
delete qm;
return 0;
}

qm->insert(t1, t2);

sipReleaseInstance(t2, sipClass_QgsOverlayObject, state);
sipReleaseInstance(t2, (sipWrapperType *) sipTypeAsPyTypeObject (sipType_QgsOverlayObject), state);
}

*sipCppPtr = qm;

0 comments on commit e67db94

Please sign in to comment.