Use of Boost library classes in kdecore?

David Jarvie lists at astrojar.org.uk
Sun Jul 8 15:15:28 BST 2007


On Sunday 08 July 2007 09:57:52 Thomas Zander wrote:
> On Sunday 08 July 2007 00:20:36 David Jarvie wrote:
> > > I'll go for the ref-counted d-pointer instead. Because there will no
> > > longer be any need to cope with implicit conversions of ref-counted
> > > classes, it should hopefully be possible to implement it using
> > > QExplicitlySharedDataPointer as Thiago suggested.
> >
> > Having looked at implementing this, I realise that it won't work. The
> > KTimeZone base class objects provided by the API must be polymorphic,
>
> Maybe I'm misunderstanding your requirements; but I don't see why it can't
> work.  To avoid long discussions; can you look at this
> mock-implementation I just quickly did ?
> It uses refcounted d-pointers and seems to do what you require.
> See the main() for what I mean;
>     FileTimeZone ftz;
>     TimeZone tz = ftz;
>     FileTimeZone ftz2 = tz;
> This compiles; and altering a setter on any of the 3 will immediately
> alter it on the other two as well.

I tested it after adding a virtual function to TimeZone, and it does work. The 
drawback of using this approach is that the private classes need to be 
publicly available in order to derive from them outside kdelibs. I suspect 
that introducing another level of private class (i.e. a d-pointer within 
the "private" classes) might fix this. 

-- 
David Jarvie.
KAlarm author and maintainer.
http://www.astrojar.org.uk/kalarm




More information about the kde-core-devel mailing list