[Kde-bindings] KDE/kdebindings/csharp

Arno Rehn arno at arnorehn.de
Wed Jul 30 00:01:28 UTC 2008


On Monday 28 July 2008 20:13:05 Richard Dale wrote:
> On Saturday 26 July 2008 20:56:44 Arno Rehn wrote:
> > SVN commit 838125 by arnorehn:
> >
> > * Use qobject_cast in the KWrite example.
> > * If CreateInstance() doesn't find a type, it now replaces the last '.'
> >   with a '+' and tries again to find nested classes.
>
> I don't think this is the best way to fix the problem. I think we need a
> Dictionary from a C++ classname to the C# type. Then another Dictionary
> that we already have to get from the Type to details about how to construct
> the instance.
>
> I'm not sure we need to have a Dictionary or QHash that goes from the C++
> classname to  the C# classname, and then finally get the Type by walking
> through all the loaded assemblies. I would have thought that was pretty
> slow apart from problems with '+'s and '.'s in  the classname paths.
Yes, it's definitely not the best solution. I think we should fix the problem 
directly in SmokeBinding::className(). We could dynamically replace every '::' 
with a '.' and then check if the type exists in C#. If it doesn't, replace the 
last '.' with '+' and so on... At the end we cache the result. We could then 
get rid of the static classname-hash initialization in every module, too.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list