Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 332503
Collapse All | Expand All

(-)trunk/KDE/kdebindings/python/pykde4/sip/kdecore/typedefs.sip (-55 lines)
Lines 733-793 Link Here
733
};
733
};
734
734
735
735
736
%MappedType QList<uint>
737
{
738
%TypeHeaderCode
739
#include <qlist.h>
740
%End
741
742
%ConvertFromTypeCode
743
    // Create the list.
744
    PyObject *l;
745
746
    if ((l = PyList_New(sipCpp->size())) == NULL)
747
        return NULL;
748
749
    // Set the list elements.
750
    for (int i = 0; i < sipCpp->size(); ++i) {
751
        PyObject *pobj;
752
753
#if PY_MAJOR_VERSION >= 3
754
        if ((pobj = PyLong_FromLong(sipCpp->value(i))) == NULL) {
755
#else
756
        if ((pobj = PyInt_FromLong(sipCpp->value(i))) == NULL) {
757
#endif
758
            Py_DECREF(l);
759
760
            return NULL;
761
        }
762
763
        PyList_SET_ITEM(l, i, pobj);
764
    }
765
766
    return l;
767
%End
768
769
%ConvertToTypeCode
770
    // Check the type if that is all that is required.
771
    if (sipIsErr == NULL)
772
        return PyList_Check(sipPy);
773
774
    QList<uint> *ql = new QList<uint>;
775
 
776
    for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i) {
777
#if PY_MAJOR_VERSION >= 3
778
        ql->append(PyLong_AsLong(PyList_GET_ITEM(sipPy, i)));
779
#else
780
        ql->append(PyInt_AsLong(PyList_GET_ITEM(sipPy, i)));
781
#endif        
782
    }
783
    
784
    *sipCppPtr = ql;
785
 
786
    return sipGetState(sipTransferObj);
787
%End
788
};
789
790
791
template <TYPE*>
736
template <TYPE*>
792
%MappedType QStack<TYPE*>
737
%MappedType QStack<TYPE*>
793
{
738
{

Return to bug 332503