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