private-cachefile.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef APT_PRIVATE_CACHEFILE_H
  2. #define APT_PRIVATE_CACHEFILE_H
  3. #include <apt-pkg/cachefile.h>
  4. #include <apt-pkg/progress.h>
  5. #include <apt-pkg/configuration.h>
  6. #include <apt-pkg/pkgcache.h>
  7. // class CacheFile - Cover class for some dependency cache functions /*{{{*/
  8. // ---------------------------------------------------------------------
  9. /* */
  10. class CacheFile : public pkgCacheFile
  11. {
  12. static pkgCache *SortCache;
  13. static int NameComp(const void *a,const void *b) APT_PURE;
  14. public:
  15. pkgCache::Package **List;
  16. void Sort();
  17. bool CheckDeps(bool AllowBroken = false);
  18. bool BuildCaches(bool WithLock = true)
  19. {
  20. OpTextProgress Prog(*_config);
  21. if (pkgCacheFile::BuildCaches(&Prog,WithLock) == false)
  22. return false;
  23. return true;
  24. }
  25. bool Open(bool WithLock = true)
  26. {
  27. OpTextProgress Prog(*_config);
  28. if (pkgCacheFile::Open(&Prog,WithLock) == false)
  29. return false;
  30. Sort();
  31. return true;
  32. };
  33. bool OpenForInstall()
  34. {
  35. if (_config->FindB("APT::Get::Print-URIs") == true)
  36. return Open(false);
  37. else
  38. return Open(true);
  39. }
  40. CacheFile() : List(0) {};
  41. ~CacheFile() {
  42. delete[] List;
  43. }
  44. };
  45. /*}}}*/
  46. #endif