KGuiAddons Review

Michael Pyne mpyne at kde.org
Wed Mar 5 01:45:38 UTC 2014


On Tue, March 4, 2014 18:46:53 John Layt wrote:
> KImageCache
> KSharedPixmapCacheMixin
> KLocalImageCacheImplementation
>  - Looks OK
>  - KImageCache not exported, but KLocalImageCacheImplementation is, some
> CMake magic involved?

No CMake. :)

KImageCache depends on KSharedDataCache from KCoreAddons but we didn't want to 
make a hard dep on KCoreAddons from KGuiAddons.

So instead the differences between KImageCache are coded into a class 
KLocalImageCacheImplementation (which is exported as you noted). The API of 
KSharedDataCache that is needed is replaced by a template class 
KSharedPixmapCacheMixin.

KImageCache itself then becomes a macro expanding to 
KSharedPixmapCacheMixin<KSharedDataCache>, which is generated by the compiler 
and thus doesn't need an export (this despite being an internal class marked 
as @internal).

Doing it this way allows a sort of "weak reference" to KSharedDataCache 
without having to define KSharedDataCache. It might even be possible to 
forward-declare KSharedDataCache and use a typedef instead but I didn't even 
do the porting work here and that didn't occur to me when I was reviewing the 
patch a few months back.

Regards,
 - Michael Pyne


More information about the Kde-frameworks-devel mailing list