LCOV - code coverage report
Current view: top level - Core - OOCache.h (source / functions) Hit Total Coverage
Test: coverxygen.info Lines: 0 23 0.0 %
Date: 2025-05-28 07:50:54 Functions: 0 0 -

          Line data    Source code
       1           0 : /*
       2             : 
       3             : OOCache.h
       4             : By Jens Ayton
       5             : 
       6             : An OOCache handles storage of a limited number of elements for quick reuse. It
       7             : may be used directly for in-memory cache, or indirectly through OOCacheManager
       8             : for on-disk cache.
       9             : 
      10             : Every OOCache has a 'prune threshold', which controls how many elements it
      11             : contains, and an 'auto-prune' flag, which determines how pruning is managed.
      12             : 
      13             : If auto-pruning is on, the cache will pruned to 80% of the prune threshold
      14             : whenever the prune threshold is exceeded. If auto-pruning is off, the cache
      15             : can be pruned to the prune threshold by explicitly calling -prune.
      16             : 
      17             : While OOCacheManager-managed caches must have string keys and property list
      18             : values, OOCaches used directly may have any keys allowable for a mutable
      19             : dictionary (that is, keys should conform to <NSCopying> and values may be
      20             : arbitrary objects) -- an 'unmanaged' cache is essentially a mutable dictionary
      21             : with a prune limit. (Project: with the addition of a -keyEnumerator method and
      22             : sutiable NSEnumerator subclass, and a -count method, it could be turned into a
      23             : subclass of NSMutableDictionary.)
      24             : 
      25             : 
      26             : Oolite
      27             : Copyright (C) 2004-2013 Giles C Williams and contributors
      28             : 
      29             : This program is free software; you can redistribute it and/or
      30             : modify it under the terms of the GNU General Public License
      31             : as published by the Free Software Foundation; either version 2
      32             : of the License, or (at your option) any later version.
      33             : 
      34             : This program is distributed in the hope that it will be useful,
      35             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      36             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      37             : GNU General Public License for more details.
      38             : 
      39             : You should have received a copy of the GNU General Public License
      40             : along with this program; if not, write to the Free Software
      41             : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
      42             : MA 02110-1301, USA.
      43             : 
      44             : */
      45             : 
      46             : #import <Foundation/Foundation.h>
      47             : 
      48             : 
      49           0 : enum
      50             : {
      51             :         kOOCacheMinimumPruneThreshold                   = 25U,
      52             :         kOOCacheDefaultPruneThreshold                   = 200U,
      53             :         kOOCacheNoPrune                                                 = 0xFFFFFFFFU
      54             : };
      55             : 
      56             : 
      57           0 : @interface OOCache: NSObject
      58             : {
      59             : @private
      60           0 :         struct OOCacheImpl              *cache;
      61           0 :         unsigned                                pruneThreshold;
      62           0 :         BOOL                                    autoPrune;
      63           0 :         BOOL                                    dirty;
      64             : }
      65             : 
      66           0 : - (id)init;
      67           0 : - (id)initWithPList:(id)pList;
      68           0 : - (id)pListRepresentation;
      69             : 
      70           0 : - (id)objectForKey:(id)key;
      71           0 : - (void)setObject:(id)value forKey:(id)key;
      72           0 : - (void)removeObjectForKey:(id)key;
      73             : 
      74           0 : - (void)setPruneThreshold:(unsigned)threshold;
      75           0 : - (unsigned)pruneThreshold;
      76             : 
      77           0 : - (void)setAutoPrune:(BOOL)flag;
      78           0 : - (BOOL)autoPrune;
      79             : 
      80           0 : - (void)prune;
      81             : 
      82           0 : - (BOOL)dirty;
      83           0 : - (void)markClean;
      84             : 
      85           0 : - (NSString *)name;
      86           0 : - (void)setName:(NSString *)name;
      87             : 
      88           0 : - (NSArray *) objectsByAge;
      89             : 
      90             : @end

Generated by: LCOV version 1.14