]> git.saurik.com Git - apt.git/blob - apt-pkg/metaindex.h
14715422778f09c398ed5947a5f798b8dc5712ae
[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/indexfile.h>
8 #include <apt-pkg/init.h>
9
10 #ifndef APT_8_CLEANER_HEADERS
11 #include <apt-pkg/srcrecords.h>
12 #include <apt-pkg/pkgrecords.h>
13 #include <apt-pkg/vendor.h>
14 using std::string;
15 #endif
16
17 class pkgAcquire;
18 class pkgCacheGenerator;
19 class OpProgress;
20
21 class metaIndex
22 {
23 protected:
24 std::vector <pkgIndexFile *> *Indexes;
25 const char *Type;
26 std::string URI;
27 std::string Dist;
28 bool Trusted;
29
30 public:
31
32 // Various accessors
33 virtual std::string GetURI() const {return URI;}
34 virtual std::string GetDist() const {return Dist;}
35 virtual const char* GetType() const {return Type;}
36
37 // interface to to query it
38 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
39 virtual std::string MetaIndexInfo(const char *Type) const {return "";};
40 virtual std::string MetaIndexFile(const char *Types) const {return "";};
41 virtual std::string MetaIndexURI(const char *Type) const {return "";};
42
43 // returns the path of the local file (or "" if its not available)
44 virtual std::string LocalFileName() const {return "";};
45 #endif
46
47 // Interface for acquire
48 virtual std::string ArchiveURI(std::string const& File) const = 0;
49 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
50 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
51 virtual bool IsTrusted() const = 0;
52
53 metaIndex(std::string const &URI, std::string const &Dist,
54 char const * const Type)
55 : Indexes(NULL), Type(Type), URI(URI), Dist(Dist)
56 {
57 /* nothing */
58 }
59
60 virtual ~metaIndex()
61 {
62 if (Indexes == 0)
63 return;
64 for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
65 I != (*Indexes).end(); ++I)
66 delete *I;
67 delete Indexes;
68 }
69 };
70
71 #endif