]> git.saurik.com Git - apt.git/blame - apt-pkg/metaindex.h
Merge remote-tracking branch 'origin/feature/source-deb822' into feature/source-deb822
[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>
7014e148 8#include <apt-pkg/init.h>
b3d44315 9
a4f6bdc8 10#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
11#include <apt-pkg/srcrecords.h>
12#include <apt-pkg/pkgrecords.h>
13#include <apt-pkg/vendor.h>
a4f6bdc8
DK
14using std::string;
15#endif
16
b3d44315
MV
17class pkgAcquire;
18class pkgCacheGenerator;
19class OpProgress;
20
21class metaIndex
22{
23 protected:
8f3ba4e8 24 std::vector <pkgIndexFile *> *Indexes;
b3d44315 25 const char *Type;
8f3ba4e8
DK
26 std::string URI;
27 std::string Dist;
b3d44315
MV
28 bool Trusted;
29
30 public:
31
b3d44315 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
7014e148
MV
37 // interface to to query it
38#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
39 // returns the path of the local file (or "" if its not available)
40 virtual std::string LocalFileName() const {return "";};
41#endif
42
b3d44315 43 // Interface for acquire
7014e148 44 virtual std::string ArchiveURI(std::string const& File) const = 0;
5dd4c8b8 45 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
8f3ba4e8 46 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
b3d44315
MV
47 virtual bool IsTrusted() const = 0;
48
7014e148
MV
49 metaIndex(std::string const &URI, std::string const &Dist,
50 char const * const Type)
51 : Indexes(NULL), Type(Type), URI(URI), Dist(Dist)
52 {
53 /* nothing */
4b42f43b
DK
54 }
55
7014e148
MV
56 virtual ~metaIndex()
57 {
7a9f09bd
MV
58 if (Indexes == 0)
59 return;
7014e148
MV
60 for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
61 I != (*Indexes).end(); ++I)
7a9f09bd
MV
62 delete *I;
63 delete Indexes;
64 }
b3d44315
MV
65};
66
67#endif