private-cachefile.h 1.1 KB

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