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

Dongxu Ma dongxu.ma at gmail.com
Fri Apr 27 10:35:59 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
> You need to be able to marshaller each typedef'd variant of the template


yes, the disadvantage is to collect all involved ones priorly.  I am working
on a
script to build the list.

> 2) function parameter, return type
> A lot of the template types are lists or hashes, and the solution that
> qtruby/qyoto uses is to have marshallers <--> bindings language as
> templated
> code. This means you only write the marshalling code once, and then have a
> different template type for each the the C++ template types with a macro
> to
> invoke it. See the code in handlers.cpp of either the QtRuby or Qyoto
> projects for a example. For instance, this line:
>
> DEF_VALUELIST_MARSHALLER( QUrlList, QList<QUrl>, QUrl )
>
> The DEF_VALUELIST_MARSHALLER() will define a new template based marshaller
> for
> QLists of QUrls.
>
> > 3) QT signal, slot
> You can't have have commas in signal and slot types, but you can have
> simple
> template types. The template types are mostly lists which have to be
> marshalled as Arrays or Lists in the bindings language.


yes, noticed that. Just 4 or 5 found in my current QT4 headers.

> 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);
> Yes, that sounds similar to the code in handlers.cpp that I describe
> above.
>
> > Could you pls explain something you've done in qtbudy or your ideas?
> > From my personal point of view, that'll be nice if we can setup a
> generic
> > solution, across
> > different scripting languages.
> Well, yes that is the idea of the Smoke library. And it allows the code
> for
> the QtRuby bindings (derived from PerlQt), and the Qyoto C# bindings to be
> very similar.


The way to keep instance pointer differ in various languages. That'll be
nice
to define marshall layer plugin for each one and plug to use.

Note that I think someone is working on a Qt4 version of the Smoke based
> PerlQt, and you need to be a bit careful about naming your project
> something
> different from just 'PerlQt' to avoid confusion.


namespace is ok.  I'd like to know him/her. Is him/her on the maillist?

-- Richard
>
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 26 Apr 2007 18:06:51 +0200
> From: Arno Rehn <arno at arnorehn.de>
> Subject: [Kde-bindings] First release of Qyoto
> To: kde-bindings at kde.org
> Message-ID: <200704261806.51778.arno at arnorehn.de>
> Content-Type: text/plain;  charset="utf-8"
>
> Hi,
>
> I think we can do a first release of Qyoto by now.
> Everything on the TODO list has been done, except maybe the translation of
> more Qt examples to C#. But for a very first release this is not that much
> important, in my opinion.
> Is there anything that still has to be done? I can't think of anything at
> the
> moment.
> What do you think?
>
> --
> Arno Rehn
> arno at arnorehn.de
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 26 Apr 2007 18:24:06 +0000
> From: Richard Dale <Richard_Dale at tipitina.demon.co.uk>
> Subject: [Kde-bindings] KDE/kdebindings/kalyptus
> To: kde-commits at kde.org
> Cc: kde-bindings at kde.org
> Message-ID: <1177611846.248662.10938.nullmailer at svn.kde.org>
> Content-Type: text/plain; charset=UTF-8
>
> SVN commit 658331 by rdale:
>
> * Some improvements for the code generation of the KDE kimono classes
>
> CCMAIL: kde-bindings at kde.org
>
>
>
> M  +116 -59   kalyptusCxxToKimono.pm
> M  +6 -33     kalyptusDataDict.pm
>
>
>
>
> ------------------------------
>
> Message: 6
> Date: Thu, 26 Apr 2007 19:24:20 +0100
> From: Richard Dale <rdale at foton.es>
> Subject: Re: [Kde-bindings] First release of Qyoto
> To: KDE bindings for other programming languages
>         <kde-bindings at kde.org>
> Message-ID: <200704261924.20831.rdale at foton.es>
> Content-Type: text/plain;  charset="iso-8859-1"
>
> On Thursday 26 April 2007, Arno Rehn wrote:
> > Hi,
> >
> > I think we can do a first release of Qyoto by now.
> > Everything on the TODO list has been done, except maybe the translation
> of
> > more Qt examples to C#. But for a very first release this is not that
> much
> > important, in my opinion.
> > Is there anything that still has to be done? I can't think of anything
> at
> > the moment.
> > What do you think?
> As far as I know, only out argument types need doing. I'm going away for
> two
> weeks on Sunday though.
>
> I've recently been working on the code generation for the KDE classes, and
> I'll check in what I have. It doesn't compile yet, but isn't far off.
> Change '-fsmoke' to '-fkimono' in kdebindings/smoke/kde/generate.pl and
> run 'perl generate.pl' to have a look.
>
> -- Richard
>
>
>
> ------------------------------
>
> Message: 7
> Date: Thu, 26 Apr 2007 21:22:12 +0000
> From: Richard Dale <Richard_Dale at tipitina.demon.co.uk>
> Subject: [Kde-bindings] KDE/kdebindings/csharp/qyoto
> To: kde-commits at kde.org
> Cc: kde-bindings at kde.org
> Message-ID: <1177622532.600979.27768.nullmailer at svn.kde.org>
> Content-Type: text/plain; charset=UTF-8
>
> SVN commit 658365 by rdale:
>
> * The classes which need to have interfaces, such as QUrl because they
>   are used with multiple inheritance in C++, were always being defined
>   as interface types in method arguments. This isn't needed, so change
>   arg types from 'IQUrl' etc to 'QUrl' etc.
>
> CCMAIL: kde-bindings at kde.org
>
>
>
> M  +7 -0      ChangeLog
> M  +14 -14    core/QUrl.cs
> M  +4 -4      core/QVariant.cs
> M  +4 -4      core/Qt.cs
> M  +1 -4      gui/QAccessibleApplication.cs
> M  +1 -2      gui/QAccessibleInterface.cs
> M  +1 -4      gui/QAccessibleWidget.cs
> M  +1 -4      gui/QAccessibleWidgetEx.cs
> M  +8 -8      gui/QBoxLayout.cs
> M  +2 -2      gui/QDesktopServices.cs
> M  +14 -14    gui/QGridLayout.cs
> M  +5 -5      gui/QLayout.cs
> M  +2 -2      gui/QPolygon.cs
> M  +2 -2      gui/QPolygonF.cs
> M  +6 -6      gui/QStackedLayout.cs
> M  +10 -10    gui/QTextBrowser.cs
> M  +6 -6      gui/QTextDocument.cs
> M  +2 -2      gui/QTextEdit.cs
> M  +2 -2      network/QUrlInfo.cs
> M  +1 -0      qdbus/QDBusArgument.cs
> M  +4 -4      sql/QSqlDatabase.cs
> M  +2 -2      sql/QSqlQuery.cs
> M  +4 -4      sql/QSqlQueryModel.cs
> M  +2 -2      sql/QSqlTableModel.cs
> M  +2 -4      xml/QXmlDefaultHandler.cs
> M  +1 -3      xml/QXmlEntityResolver.cs
> M  +10 -10    xml/QXmlReader.cs
> M  +20 -20    xml/QXmlSimpleReader.cs
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
>
>
> End of Kde-bindings Digest, Vol 48, Issue 21
> ********************************************
>



-- 
cheers,
-dongxu
__END__
http://search.cpan.org/~dongxu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20070427/a2fcf98c/attachment.html>


More information about the Kde-bindings mailing list