private-cachefile.h 1.2 KB

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