[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Proposal for dcopidl/dcopidl2cpp improvement
From:       weis <weis () stud ! uni-frankfurt ! de>
Date:       1999-11-12 12:39:59
[Download RAW message or body]

Hi,

On Thu, 11 Nov 1999, David Faure wrote:

> Up to now, one has to create a new class (like the *IFace classes)
> in order to run dcopidl on it. But since DCOPObject isn't a
> QObject, why shouldn't one be able to add the DCOPObject implementation
> to an existing class (which can be a QObject) ?
> 
> I've just been trying to run dcopidl on something like :
> class MyWin : public KTMainWindow, DCOPObject {
>   K_DCOP
>   Q_OBJECT
> public:
> ... (constructor, destructor, methods, members, everything)
> k_dcop:
>  void loadURL( QString url );
> 
> 
> I fixed dcopidl to ignore Q_OBJECT, no problem.
> The problem is that dcopidl2cpp behaves strangely with multiple inheritance :
> - it assumes that all super classes are DCOPObjects 
>    (it calls the ::process method on <classname>_stub)
>   Obviously KTMainWindow_stub::process doesn't exist :)
> - it calls the constructor of the first super class only
>   (and I can't make DCOPObject the first one since Q_OBJECT has to be the first one)
> In fact dcopidl2cpp is able to deal with 1 parent class if it's any DCOPObject child, but
> not with 2 parent classes.
> 
> The fix I'm thinking of would be simple : ignore parent classes and always 
> assume we inherit only from DCOPObject.
> 
> [ When I remove manually <SUPER name="KTMainWindow"/> from the .kdil file, everything
>   works fine ]
> 
> Obviously it wouldn't be possible to inherit a dcopidl interface from another.
> Is this a problem for anybody ? (The current code doesn't do that at all, but in
> the future, I don't know).
> 
> AFAICS, we can't have both. Because dcopidl2cpp has no way to know which
> parent classes are DCOPObjects and which aren't. Or we need to introduce yet
> another tag for that, to tell dcopidl2cpp what to do.

I dont like to drop inheritance. It was for long times a bad constraint
on Visual Basic for example.

But your problem can be fixed in another way:
Always assume that the right most super class is the DCOPObject or
DCOPObject derived one. That works in cases with no multiple
inheritance and always works if you inherit from some QObject class,
since the QObject class has always to be leftmost.

Simple fix and your problem should be solved, or did I overlook
something ?

Bye
Torben

> -- 
> David FAURE
> david@mandrakesoft.com, faure@kde.org
> http://home.clara.net/faure/
> KDE, Making The Future of Computing Available Today
> 
> 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic