metaindex.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Include Files /*{{{*/
  2. #include <apt-pkg/indexfile.h>
  3. #include <apt-pkg/metaindex.h>
  4. #include <stddef.h>
  5. #include <string>
  6. #include <vector>
  7. /*}}}*/
  8. #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  9. std::string metaIndex::LocalFileName() const { return ""; }
  10. #else
  11. #include <apt-pkg/debmetaindex.h>
  12. std::string metaIndex::LocalFileName() const
  13. {
  14. debReleaseIndex const * deb = dynamic_cast<debReleaseIndex const*>(this);
  15. if (deb != NULL)
  16. return deb->LocalFileName();
  17. return "";
  18. }
  19. #endif
  20. metaIndex::metaIndex(std::string const &URI, std::string const &Dist,
  21. char const * const Type)
  22. : Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(false)
  23. {
  24. /* nothing */
  25. }
  26. metaIndex::~metaIndex()
  27. {
  28. if (Indexes == 0)
  29. return;
  30. for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
  31. I != (*Indexes).end(); ++I)
  32. delete *I;
  33. delete Indexes;
  34. }