]> git.saurik.com Git - apt.git/blame - apt-pkg/metaindex.h
test/integration/test-essential-force-loopbreak: fix on non-amd64 systems
[apt.git] / apt-pkg / metaindex.h
CommitLineData
b3d44315
MV
1#ifndef PKGLIB_METAINDEX_H
2#define PKGLIB_METAINDEX_H
3
b3d44315 4#include <apt-pkg/indexfile.h>
7014e148 5#include <apt-pkg/init.h>
b3d44315 6
453b82a3
DK
7#include <stddef.h>
8
9#include <string>
10#include <vector>
11
12#ifndef APT_10_CLEANER_HEADERS
13#include <apt-pkg/pkgcache.h>
14class pkgCacheGenerator;
15class OpProgress;
16#endif
a4f6bdc8 17#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
18#include <apt-pkg/srcrecords.h>
19#include <apt-pkg/pkgrecords.h>
20#include <apt-pkg/vendor.h>
a4f6bdc8
DK
21using std::string;
22#endif
23
b3d44315 24class pkgAcquire;
b3d44315
MV
25
26class metaIndex
27{
28 protected:
8f3ba4e8 29 std::vector <pkgIndexFile *> *Indexes;
b3d44315 30 const char *Type;
8f3ba4e8
DK
31 std::string URI;
32 std::string Dist;
b3d44315
MV
33 bool Trusted;
34
35 public:
36
b3d44315 37 // Various accessors
8f3ba4e8
DK
38 virtual std::string GetURI() const {return URI;}
39 virtual std::string GetDist() const {return Dist;}
b3d44315
MV
40 virtual const char* GetType() const {return Type;}
41
7014e148
MV
42 // interface to to query it
43#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
44 // returns the path of the local file (or "" if its not available)
45 virtual std::string LocalFileName() const {return "";};
46#endif
47
b3d44315 48 // Interface for acquire
7014e148 49 virtual std::string ArchiveURI(std::string const& File) const = 0;
5dd4c8b8 50 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
8f3ba4e8 51 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
b3d44315
MV
52 virtual bool IsTrusted() const = 0;
53
7014e148
MV
54 metaIndex(std::string const &URI, std::string const &Dist,
55 char const * const Type)
56 : Indexes(NULL), Type(Type), URI(URI), Dist(Dist)
57 {
58 /* nothing */
4b42f43b
DK
59 }
60
7014e148
MV
61 virtual ~metaIndex()
62 {
7a9f09bd
MV
63 if (Indexes == 0)
64 return;
7014e148
MV
65 for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin();
66 I != (*Indexes).end(); ++I)
7a9f09bd
MV
67 delete *I;
68 delete Indexes;
69 }
b3d44315
MV
70};
71
72#endif