You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
1.7 KiB

  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: cachefile.h,v 1.5 2002/04/27 04:28:04 jgg Exp $
  4. /* ######################################################################
  5. CacheFile - Simple wrapper class for opening, generating and whatnot
  6. This class implements a simple 2 line mechanism to open various sorts
  7. of caches. It can operate as root, as not root, show progress and so on,
  8. it transparently handles everything necessary.
  9. This means it can rebuild caches from the source list and instantiates
  10. and prepares the standard policy mechanism.
  11. ##################################################################### */
  12. /*}}}*/
  13. #ifndef PKGLIB_CACHEFILE_H
  14. #define PKGLIB_CACHEFILE_H
  15. #include <apt-pkg/depcache.h>
  16. #include <apt-pkg/acquire.h>
  17. #include <apt-pkg/sourcelist.h>
  18. class pkgPolicy;
  19. class pkgCacheFile
  20. {
  21. protected:
  22. MMap *Map;
  23. pkgCache *Cache;
  24. pkgDepCache *DCache;
  25. public:
  26. pkgPolicy *Policy;
  27. // We look pretty much exactly like a pointer to a dep cache
  28. inline operator pkgCache &() {return *Cache;};
  29. inline operator pkgCache *() {return Cache;};
  30. inline operator pkgDepCache &() {return *DCache;};
  31. inline operator pkgDepCache *() {return DCache;};
  32. inline pkgDepCache *operator ->() {return DCache;};
  33. inline pkgDepCache &operator *() {return *DCache;};
  34. inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
  35. inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];};
  36. bool BuildCaches(OpProgress &Progress,bool WithLock = true);
  37. bool Open(OpProgress &Progress,bool WithLock = true);
  38. void Close();
  39. pkgCacheFile();
  40. ~pkgCacheFile();
  41. };
  42. #endif