diff options
author | Adam Reichold <adam.reichold@t-online.de> | 2018-09-21 18:07:04 +0200 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2018-10-04 23:08:52 +0000 |
commit | 70e929e682cec8b60120ae3b1320eab457bd2ea7 (patch) | |
tree | 060d49f07ad6f2f8de75a0e3740959e44d06bb62 /poppler/PopplerCache.h | |
parent | cb8a526906687d85dfa5af1b30a585e76e2762a7 (diff) |
Remove specialized PopplerObjectCache since it has only one user and the additional abstraction actually obscures how it is used instead of simplifying it.
Diffstat (limited to 'poppler/PopplerCache.h')
-rw-r--r-- | poppler/PopplerCache.h | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/poppler/PopplerCache.h b/poppler/PopplerCache.h index 1bd039ef..3587cb91 100644 --- a/poppler/PopplerCache.h +++ b/poppler/PopplerCache.h @@ -15,9 +15,8 @@ #include <algorithm> #include <memory> - -#include "Object.h" -#include "XRef.h" +#include <utility> +#include <vector> template<typename Key, typename Item> class PopplerCache @@ -60,28 +59,4 @@ private: std::vector<std::pair<Key, std::unique_ptr<Item>>> entries; }; -class PopplerObjectCache -{ -public: - PopplerObjectCache(std::size_t cacheSizeA, XRef *xrefA) : cache{cacheSizeA}, xref{xrefA} {} - - Object lookup(const Ref &ref) { - if (Object *item = cache.lookup(ref)) { - return item->copy(); - } else { - return Object{objNull}; - } - } - - Object *put(const Ref &ref) { - Object *item = new Object{xref->fetch(ref.num, ref.gen)}; - cache.put(ref, item); - return item; - } - -private: - PopplerCache<Ref, Object> cache; - XRef *xref; -}; - #endif |