diff options
author | lordjaxom <lordjaxom> | 2005-01-28 21:26:34 +0000 |
---|---|---|
committer | lordjaxom <lordjaxom> | 2005-01-28 21:26:34 +0000 |
commit | c5a641a335f198435cd84f0e5e45dbab94089a81 (patch) | |
tree | 2d7db171fa69c7ba7d93a26edad2094fc2d254a3 /cache.h | |
parent | 2c823c26e341dc67052467864e2299663c9a7b8f (diff) | |
download | vdr-plugin-text2skin-c5a641a335f198435cd84f0e5e45dbab94089a81.tar.gz vdr-plugin-text2skin-c5a641a335f198435cd84f0e5e45dbab94089a81.tar.bz2 |
- fixup of template handling, which is obviously too broken to work everywhere
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 22 |
1 files changed, 7 insertions, 15 deletions
@@ -1,5 +1,5 @@ /* - * $Id: cache.h,v 1.4 2005/01/27 10:53:07 lordjaxom Exp $ + * $Id: cache.h,v 1.5 2005/01/28 21:26:34 lordjaxom Exp $ */ #ifndef VDR_TEXT2SKIN_CACHE_HPP @@ -22,12 +22,12 @@ private: uint mMaxItems; protected: - void Delete(const key_type &Key, data_type &Data) {} - void Reset(data_type &Data) {} + virtual void DeleteObject(const key_type &Key, data_type &Data) = 0; + virtual void ResetObject(data_type &Data) = 0; public: cxCache(uint MaxItems); - ~cxCache(); + virtual ~cxCache(); void Reset(void); void Flush(void); @@ -54,20 +54,12 @@ cxCache<key_type, data_type>::~cxCache() Flush(); } -/*XXX move -template<class key_type, class data_type> -void cxCache<key_type, data_type>::Delete(const key_type &Key, data_type &Data) -{ - delete Data; -} -*/ - template<class key_type, class data_type> void cxCache<key_type, data_type>::Flush(void) { item_iterator it = mItems.begin(); for (; it != mItems.end(); ++it) - Delete(it->first, it->second); + DeleteObject(it->first, it->second); mUsage.clear(); mItems.clear(); @@ -78,7 +70,7 @@ void cxCache<key_type, data_type>::Reset(void) { item_iterator it = mItems.begin(); for (; it != mItems.end(); ++it) - Reset(it->second); + ResetObject(it->second); } template<class key_type, class data_type> @@ -99,7 +91,7 @@ data_type &cxCache<key_type, data_type>::operator[](const key_type &Key) if (mUsage.size() == mMaxItems) { item_iterator it = mItems.find(*mUsage.begin()); - Delete(it->first, it->second); + DeleteObject(it->first, it->second); mUsage.erase(mUsage.begin()); mItems.erase(it); } |