metaindex.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Include Files /*{{{*/
  2. #include <apt-pkg/pkgcachegen.h>
  3. #include <apt-pkg/indexfile.h>
  4. #include <apt-pkg/metaindex.h>
  5. #include <stddef.h>
  6. #include <string>
  7. #include <vector>
  8. /*}}}*/
  9. #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  10. std::string metaIndex::LocalFileName() const { return ""; }
  11. #else
  12. #include <apt-pkg/debmetaindex.h>
  13. std::string metaIndex::LocalFileName() const
  14. {
  15. debReleaseIndex const * deb = dynamic_cast<debReleaseIndex const*>(this);
  16. if (deb != NULL)
  17. return deb->LocalFileName();
  18. return "";
  19. }
  20. #endif
  21. std::string metaIndex::Describe() const
  22. {
  23. return "Release";
  24. }
  25. pkgCache::RlsFileIterator metaIndex::FindInCache(pkgCache &Cache, bool const) const
  26. {
  27. return pkgCache::RlsFileIterator(Cache);
  28. }
  29. bool metaIndex::Merge(pkgCacheGenerator &Gen,OpProgress *) const
  30. {
  31. return Gen.SelectReleaseFile("", "");
  32. }
  33. metaIndex::metaIndex(std::string const &URI, std::string const &Dist,
  34. char const * const Type)
  35. : Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(false)
  36. {
  37. /* nothing */
  38. }
  39. metaIndex::~metaIndex()
  40. {
  41. if (Indexes == 0)
  42. return;
  43. for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
  44. I != (*Indexes).end(); ++I)
  45. delete *I;
  46. delete Indexes;
  47. }