[Nepomuk] SimpleResource rcgen redesign draft

Sebastian Trüg trueg at kde.org
Mon Jul 25 18:30:05 CEST 2011


Now that the SimpleResource rcgen is in git master[1] some people used
it (mostly for Akonadi feeders and the web extractor framework) and
found it to be a bit strange.

This is true. Current usage is as follows:

SimpleResource r;
NCO::PersonContact(&r).setFullname("foobar");

The reason for this is simple: due to multi-inheritance problems I
cannot derive the generated classes from SimpleResource. Thus, we need
wrappers.

Now some ideas were floating around and I would like to settle on one
better solution.

One idea would be to have a hybrid thing where you could do this:

  NCO::PersonContact pc;
  pc.setFullname("foobar");
  SimpleResource r = rc.resource();

and this:

  SimpleResource r;
  NCO::PersonContact pc(r);
  pc.setFullname("foobar");
  r = pc.resource();

(The last line would be required since all SimpleResources would be copies.)

We could go on like so:

  r.addProperty(...);
  pc = r;
  pc.setResource(r);

The only disadvantage I see here might be a slight performance overhead
due to the copying of the resources.

Opinions?

Cheers,
Sebastian

[1]
http://quickgit.kde.org/?p=kde-runtime.git&a=blob&h=304db56a9aff5523a5672415550c49d4b7269c3c&hb=344806a2e378f3421399cad39a63f14a4428308b&f=nepomuk/services/storage/lib/nepomuk-simpleresource-rcgen.py


More information about the Nepomuk mailing list