metaindex.h 1.3 KB

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