Commit | Line | Data |
---|---|---|
b3d44315 MV |
1 | #ifndef PKGLIB_METAINDEX_H |
2 | #define PKGLIB_METAINDEX_H | |
3 | ||
b3d44315 MV |
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> | |
b3d44315 MV |
11 | |
12 | class pkgAcquire; | |
13 | class pkgCacheGenerator; | |
14 | class OpProgress; | |
15 | ||
16 | class metaIndex | |
17 | { | |
18 | protected: | |
8f3ba4e8 | 19 | std::vector <pkgIndexFile *> *Indexes; |
b3d44315 | 20 | const char *Type; |
8f3ba4e8 DK |
21 | std::string URI; |
22 | std::string Dist; | |
b3d44315 MV |
23 | bool Trusted; |
24 | ||
25 | public: | |
26 | ||
27 | ||
28 | // Various accessors | |
8f3ba4e8 DK |
29 | virtual std::string GetURI() const {return URI;} |
30 | virtual std::string GetDist() const {return Dist;} | |
b3d44315 MV |
31 | virtual const char* GetType() const {return Type;} |
32 | ||
33 | // Interface for acquire | |
8f3ba4e8 | 34 | virtual std::string ArchiveURI(std::string const& /*File*/) const = 0; |
5dd4c8b8 | 35 | virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0; |
b3d44315 | 36 | |
8f3ba4e8 | 37 | virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0; |
b3d44315 MV |
38 | virtual bool IsTrusted() const = 0; |
39 | ||
8f3ba4e8 | 40 | metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) : |
4b42f43b DK |
41 | Indexes(NULL), Type(Type), URI(URI), Dist(Dist) { |
42 | } | |
43 | ||
7a9f09bd MV |
44 | virtual ~metaIndex() { |
45 | if (Indexes == 0) | |
46 | return; | |
8f3ba4e8 | 47 | for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I) |
7a9f09bd MV |
48 | delete *I; |
49 | delete Indexes; | |
50 | } | |
b3d44315 MV |
51 | }; |
52 | ||
53 | #endif |