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