1 //========================================================================
5 // This file is licensed under the GPLv2 or later
7 // Copyright (C) 2009 Koji Otani <sho@bbr.jp>
8 // Copyright (C) 2009, 2010 Albert Astals Cid <aacid@kde.org>
9 // Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org>
11 //========================================================================
13 #ifndef POPPLER_CACHE_H
14 #define POPPLER_CACHE_H
18 class PopplerCacheItem
21 virtual ~PopplerCacheItem();
27 virtual ~PopplerCacheKey();
28 virtual bool operator==(const PopplerCacheKey
&key
) const = 0;
34 PopplerCache(int cacheSizeA
);
37 /* The item returned is owned by the cache */
38 PopplerCacheItem
*lookup(const PopplerCacheKey
&key
);
40 /* The key and item pointers ownership is taken by the cache */
41 void put(PopplerCacheKey
*key
, PopplerCacheItem
*item
);
43 /* The max size of the cache */
46 /* The number of items in the cache */
49 /* The n-th item in the cache */
50 PopplerCacheItem
*item(int index
);
52 /* The n-th key in the cache */
53 PopplerCacheKey
*key(int index
);
56 PopplerCache(const PopplerCache
&cache
); // not allowed
58 PopplerCacheKey
**keys
;
59 PopplerCacheItem
**items
;
60 int lastValidCacheIndex
;
64 class PopplerObjectCache
67 PopplerObjectCache (int cacheSizeA
, XRef
*xrefA
);
68 ~PopplerObjectCache();
70 Object
*put(const Ref
&ref
);
71 Object
*lookup(const Ref
&ref
, Object
*obj
);