metaindex.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef PKGLIB_METAINDEX_H
  2. #define PKGLIB_METAINDEX_H
  3. #include <string>
  4. #include <apt-pkg/pkgcache.h>
  5. #include <apt-pkg/srcrecords.h>
  6. #include <apt-pkg/pkgrecords.h>
  7. #include <apt-pkg/indexfile.h>
  8. #include <apt-pkg/vendor.h>
  9. class pkgAcquire;
  10. class pkgCacheGenerator;
  11. class OpProgress;
  12. class metaIndex
  13. {
  14. protected:
  15. std::vector <pkgIndexFile *> *Indexes;
  16. const char *Type;
  17. std::string URI;
  18. std::string Dist;
  19. bool Trusted;
  20. public:
  21. // Various accessors
  22. virtual std::string GetURI() const {return URI;}
  23. virtual std::string GetDist() const {return Dist;}
  24. virtual const char* GetType() const {return Type;}
  25. // Interface for acquire
  26. virtual std::string ArchiveURI(std::string const& /*File*/) const = 0;
  27. virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
  28. virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
  29. virtual bool IsTrusted() const = 0;
  30. metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) :
  31. Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
  32. }
  33. virtual ~metaIndex() {
  34. if (Indexes == 0)
  35. return;
  36. for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
  37. delete *I;
  38. delete Indexes;
  39. }
  40. };
  41. #endif