[Kde-games-devel] Unify pixmap caching across card games

Andreas Pakulat apaku at gmx.de
Sun Jan 6 15:15:57 CET 2008


On 06.01.08 16:52:44, Dmitry Suzdalev wrote:
> Looks nice!
> 
> Minor thing is: how about adding "const" modifier to "get" methods? :)

Not possible, because getXXX might modify data as the requested card
might not yet have been in the cache.

Theoretically getOrLoadXXX would be the right name, but I find that a
bit too verbose. And IMHO separating into 2 functions isn't of much use
as the client then has to do something like

QPixmap pix = cache.getCard(...);
if( !pix.isValid() )
  pix = cache.loadCard(...);

Andreas

-- 
It is so very hard to be an
on-your-own-take-care-of-yourself-because-there-is-no-one-else-to-do-it-for-you
grown-up.


More information about the kde-games-devel mailing list