metaindex.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. class pkgAcquire;
  7. class pkgCacheGenerator;
  8. class OpProgress;
  9. class metaIndex
  10. {
  11. protected:
  12. std::vector <pkgIndexFile *> *Indexes;
  13. const char *Type;
  14. std::string URI;
  15. std::string Dist;
  16. bool Trusted;
  17. public:
  18. // Various accessors
  19. virtual std::string GetURI() const {return URI;}
  20. virtual std::string GetDist() const {return Dist;}
  21. virtual const char* GetType() const {return Type;}
  22. // Interface for acquire
  23. virtual std::string ArchiveURI(std::string const& /*File*/) const = 0;
  24. virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
  25. virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
  26. virtual bool IsTrusted() const = 0;
  27. metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) :
  28. Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
  29. }
  30. virtual ~metaIndex() {
  31. if (Indexes == 0)
  32. return;
  33. for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
  34. delete *I;
  35. delete Indexes;
  36. }
  37. };
  38. #endif