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