DataEngine & KPluginFactory

Sebastian Kügler sebas at kde.org
Mon Jul 1 11:53:53 UTC 2013


On Monday, July 01, 2013 13:35:27 Kevin Krammer wrote:
> On Monday, 2013-07-01, Sebastian Kügler wrote:
> > On Monday, July 01, 2013 09:03:29 Kevin Krammer wrote:
> > > What if the macro only creates the header content (as its name already
> > > suggests)?
> > >
> > > name::create() could then be implemented in a plugin specific way, not
> > > requiring a certain constructor pattern or specifying of "baseclass".
> >
> > I'd rather save the user writing that boilerplate.
> 
> Hmm, but doesn't the current macro require to write boilerplate code since
> it  is only applicable for a certain case?
> 
> I.e. it requires that objects either have a constructor that matches the 
> expected siganture or require to write the whole plugin factor subclass 
> manually.
> 
> A macro that leaves the implementation of the method to the plugin creator 
> allows to share all the boilerplate while also allowing all flexibility on 
> object instance creation.
> 
> If it is really necessary to make the one specific use case doable without 
> writing any code I would add a second macro that does this specific 
> implementation.
> That way the common boilerplate code can be shared by allm those that only 
> every create instance of one object and have the required parent/args 
> constructor just use the second macro in addition.

Well, the goal, for me, is to make plugin factories work. Right now, we only 
have a handful constructor, and I want to make it possible to build those with 
as little extra hassle as possible -- it means porting all plugins, and that's 
a lot already, even if it's just moving a macro into the header file.

I think we can make arbitrary ctors for plugins possible, but as I said, those 
would then just not use this macro, but supply their own macro that does the 
setup of the KPluginFactory instance.

Cheers,
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Kde-frameworks-devel mailing list