metaindex.h 1.2 KB

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