inter-plugin dependencies and BC
Kuba Ober
kuba at mareimbrium.org
Thu Sep 8 16:08:03 UTC 2005
> > I'm all for it. I think we already discussed something like that one or
> > two years ago. In Qt Designer 4 I *solved* the problem with a library
> > called "extension framework". The extension framework is an
> > implementation of the adaptor pattern
So, looking at the code below, you essentially only access adaptors that
provide the interface that you need, and never access the instance directly,
right?
[...]
> > struct MyInterfaceV1
> > { ...
> > virtual void method1() = 0;
> > };
> > Q_DECLARE_EXTENSION_INTERFACE(MyInterfaceV1, "org.kdevelop.iface.v1")
> >
> > struct MyInterfaceV2
> > { ...
> > virtual void method1() = 0;
> > virtual void method2() = 0;
> > };
> > Q_DECLARE_EXTENSION_INTERFACE(MyInterfaceV2, "org.kdevelop.iface.v2")
> >
> > now you can ask which extension your instance support. Of course the
> > instance can support both extension.
> >
> > if (MyInterfaceV1 *v1 = qt_extension<MyInterfaceV1*>(m, instance))
> > {
> > // do something
> > }
> > else if (MyInterfaceV2 *v2 = qt_extension<MyInterfaceV2*>(m, instance))
> > {
> > // do something else
> > }
Quick questions:
1. Is the 'instance' in the code above the instance pointer that you obtain
from some type of a factory in the plugin?
2. What's 'm' (I'm too lazy to look at the actual code)?
Cheers, Kuba
More information about the KDevelop-devel
mailing list