Plugin loader (was: Re: "get hot new stuff" button)
Simon Hausmann
hausmann at kde.org
Fri Jun 21 16:03:21 BST 2002
On Fri, Jun 21, 2002 at 11:09:01AM +0200, Frerich Raabe wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Friday 21 June 2002 10:33, Simon Hausmann wrote:
> > 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:
> > > > >
> > > > > 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?
>
> Hmm, perhaps InheritanceDetector does what you need? That's not perfectly
> typesafe, but at least it matches only subclasses (hope that's not a
> problem).
The inheritance detector works at compile time, while we need to
figure out the inheritance at run-time.
Simon
More information about the kde-core-devel
mailing list