[Kde-bindings] question of c++ template class

Dongxu Ma dongxu.ma at gmail.com
Thu Apr 26 11:04:32 UTC 2007


Hi Richard, CC: all,

I am recently thinking about how to deal with c++ template class in QT/KDE
bindings.
Inside QT4 I found three places where templates get involved:
1) typedef
2) function parameter, return type
3) QT signal, slot

It is a little bit hard to support template class inside scripting language,
how do you
make it available for qtruby (or not) ? This was not mentioned on
kdebindings ruby
page. Sorry I am totally new to ruby.

Idea in my mind is:
1) get all template declarations from source;
2) introduce a base template in perl for those types which share the same
base template
    like QList<Q3DockWindow *>, QList<Q3ToolBar *> we create QList.
    such base template can create a specific namespace for demanded type
runtimely, say
    QList_Q3DockWindow_Ptr (cached in future), and push all available
methods into it.
    Inside QList c++ code holds a function dictionary to cast generic
pointer from vm to
    template type instance (possibly by interpret_cast or static_cast);

Could you pls explain something you've done in qtbudy or your ideas?


More information about the Kde-bindings mailing list