Plugin loader (was: Re: "get hot new stuff" button)

Simon Hausmann hausmann at kde.org
Fri Jun 21 09:33:21 BST 2002


On Fri, Jun 21, 2002 at 10:22:09AM +0200, Cornelius Schumacher wrote:
> On Friday 21 June 2002 10:02, David Faure wrote:
> > On Friday 21 June 2002 09:54, Cornelius Schumacher wrote:
> > > On Friday 21 June 2002 08:02, David Faure wrote:
> > > > On Thursday 20 June 2002 23:56, Cornelius Schumacher wrote:
> > > > > By the way, how many different plugin loading frameworks do we have
> > > > > in KDE?
> > > >
> > > > Only one and it's called KLibLoader+KTrader ;)
> > >
> > > I know about them ;-) Of course you can build a plugin loader on top of
> > > these classes, but it requires additional code which is similar in all
> > > apps using plugins. What I'm missing is something which would it make
> > > possible to write plugin loading code like this:
> > >
> > > PluginLoader<SomeClass> loader;
> > > PluginInfo::List list = loader.availablePlugins();
> > > SomeClass *plugin = loader.load( list[1] );
> > > QPtrList<SomeClass> pluginList = loader.loadAll();
> > >
> > > This would hide ugly things like passing around library names or casting
> > > factory classes to the right type.
> >
> > Sorry, I forgot to mention KParts::ComponentFactory, which is exactly what
> > you want.
> 
> Doesn't this only work for classes inheriting from QObject?

Yes, but how else do you want to make it type-safe using a template?

(d-cast has its know problems, qt_cast requires class name as string
-> not available when just having a typename in a template)


Simon




More information about the kde-core-devel mailing list