[Kde-imaging] Kipi interface a last time
Jesper K. Pedersen
blackie at kde.org
Sat Apr 24 10:32:49 CEST 2004
EVERYONE PLEASE READ CAREFULLY
Seems like we will never get done with this.
Yesterday evening Aurelien and I took another round with this topic, and for
the rest of you let me please reiterate shortly:
With the interfaces we need to figure out exactly who is owners of pointers
and when things will be evaluated.
Starting with the later.
The cd archiving plugin needs to know the size of each album, with KIPI's
interface an album could contain images stored in different directories (and
that is the case for say KimDaBa), but even worse, the images are represented
as KURL's, so at some point this means that the images might be located on
the other side of the globe. The cdarchiving plugin would be useless if it
should do a stat for each file individually, so I could imagine that apps
could have the possibility to store this info in their database some way or
the other,
Now this means that each host application must be able to override some
getSizeOfImage method. This method would logically fit into the ImageInfo
object returned by the info method in KIPI::Interfaces class.
This leaves us with this interface:
namespace KIPI {
class Interface {
..
ImageInfo* imageInfo( const KURL& which );
}
}
The major disadvantage with this is that the ImageInfo pointer returned must
be owned by someone....
Aurelien amd I came up with the idea of returning a reference instead of a
pointer, that would tell people that the data might change (It is a reference
to someone elses object, and that someone else might change it!)
namespace KIPI {
class Interface {
..
ImageInfo& imageInfo( const KURL& which );
}
}
Now in my code would look like this:
ImageInfo& KimDaBa::Interface::imageInfo( const KURL& which ) {
static ImageInfo info; // Each time this function is called I will override
previous active version
More information about the Kde-imaging
mailing list