[Kde-bindings] KDE/kdebindings

Richard Dale rdale at foton.es
Mon Jun 9 09:38:12 UTC 2008


On Sunday 08 June 2008 11:27:54 Arno Rehn wrote:
> Am Samstag 07 Juni 2008 19:14:43 schrieb Richard Dale:
> > On Saturday 07 June 2008 12:13:54 Arno Rehn wrote:
> > > SVN commit 817998 by arnorehn:
> > >
> > > * C++ namespaces are now mapped to C# namespaces. If a class is in no
> > > namespace, it is put into 'Kimono' (or 'Qyoto' for Qt).
> > > * The functions within a namespace are put into a class called 'Global'
> > > in the C# namespace.
> > > * Added the qxmlstream.h header.
> >
> > Sounds good. What about the idea to move nested classes into there own
> > source files that you talked about on irc? I've thought about that since,
> > and I'm really not keen on the idea. For instance, there are some really
> > small nested classes in Qt, and it will just clutter the project up if we
> > move them out.
>
> Yep, I've removed that part of the patch. Nested classes are still in the
> same source file as their containing class.
I had a look at the generated code, and I think it has come out very nice. I 
slightly simplified the declaration of the Global classes to look like this:

	[SmokeClass("Soprano")]
	public class Global {
		private static SmokeInvocation staticInterceptor = null;
		static Global() {
			staticInterceptor = new SmokeInvocation(typeof(Global), null);
		}

Without explicitly inheriting from Object, and no interceptor needed for 
instance methods as they are all static in a namespace. In the Soprano 
classes with nested namespaces it generated code like this:

namespace Soprano.Vocabulary.NAO {
  ...

Which is really nice - I didn't realize that was valid C#.

The only thing I don't like is subclassing SmokeInvocation and giving it a 
different name in the generated code. That seems pointless and ugly to me any 
old static constructor will load the smoke lib. In the soprano bindings I had 
a source called 'Soprano.cs' with this:

namespace Soprano {
	using Qyoto;
	using System;
	using System.Runtime.InteropServices;

	public class InitSoprano {
		[DllImport("libsoprano-sharp", CharSet=CharSet.Ansi)]
		static extern void Init_soprano();
		
		static InitSoprano() {
			Init_soprano();
		}
	}
}

And just left SmokeInvocation as it was in the generated code. So I think we 
should have a Kimono.cs source with the same thing in it.

When I tried to compile the Kimono code I got an error about an unimplemented 
abstract method. I wonder if the easiest thing to fix that is to have partial 
classes with the missing methods in them with empty bodies.

-- Richard







More information about the Kde-bindings mailing list