cachefile.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: cachefile.h,v 1.1 1999/04/18 06:36:36 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. ##################################################################### */
  10. /*}}}*/
  11. #ifndef PKGLIB_CACHEFILE_H
  12. #define PKGLIB_CACHEFILE_H
  13. #ifdef __GNUG__
  14. #pragma interface "apt-pkg/cachefile.h"
  15. #endif
  16. #include <apt-pkg/depcache.h>
  17. #include <apt-pkg/dpkginit.h>
  18. class pkgCacheFile
  19. {
  20. protected:
  21. MMap *Map;
  22. pkgDepCache *Cache;
  23. pkgDpkgLock *Lock;
  24. public:
  25. // We look pretty much exactly like a pointer to a dep cache
  26. inline operator pkgDepCache &() {return *Cache;};
  27. inline pkgDepCache *operator ->() {return Cache;};
  28. inline pkgDepCache &operator *() {return *Cache;};
  29. // Release the dpkg status lock
  30. inline void ReleaseLock() {Lock->Close();};
  31. bool Open(OpProgress &Progress,bool WithLock = true);
  32. pkgCacheFile();
  33. ~pkgCacheFile();
  34. };
  35. #endif