[PyKDE] SIP questions

Johannes Sixt Johannes.Sixt at telecom.at
Sun Apr 30 18:24:29 BST 2000


On Sun, 30 Apr 2000, Per Wigren wrote:
>> > Is this because Sip doesn't support subclasses or is it the KURL> thingy?
>> 
>> SIP doesn't support sub-classes.  It looks like it might need to.
>
>Yes. Can I still create the sipfiles with that syntax? Will that syntax be
>used when it supports subclasses?

A nested class is only restricted in its visiblity and accessibility, but its
functionality is no different from if it were a global class. So, for now you
can just make that class a global class.

Nested classes are supported by Python itself. What SIP could do is generate a
SIP implementation like for any other class, but register the class as a nested
class in Python (somehow).

>Does Sip support the Class<THING> stuff? That is seen all over the KDE2
>headers... But I can't find it in the pykde 0.11.1 sipfiles... I think that is
>"templates" but I do not know exactly how templates work in C++....

Yes, these are templates. You have to look at each to decide what to do. In the
particular example you gave (KURL::List) you wouldn't need a SIP class at all.
This is just a list of KURLs, Python already has lists. Just stuff in a KURL
after the other:

    bla = [KURL(), KURL("http://www.kde.org")]   # or whatever

>How do I determine when I need some create some special %Membercode? In what
>cases is that needed?

When the parameter types are non-standard or if there is a more natural way to
pass args or return results in Python. Eg. some functions return a bool that
indicates success, but pass the real result in a variable that is passed in by
reference. In this case you would just return a tuple with the bool and the
result. Here you need a %MemberCode.

This is just a guess from what I've seen so far. Correct me if I'm wrong,
please!

-- Hannes




More information about the PyQt mailing list