]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debmetaindex.h
b448ecc53e1b3e8cc10f1f2c90460142a3473d93
[apt.git] / apt-pkg / deb / debmetaindex.h
1 // ijones, walters
2 #ifndef PKGLIB_DEBMETAINDEX_H
3 #define PKGLIB_DEBMETAINDEX_H
4
5 #include <apt-pkg/metaindex.h>
6 #include <apt-pkg/macros.h>
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #ifndef APT_8_CLEANER_HEADERS
13 #include <apt-pkg/sourcelist.h>
14 #endif
15 #ifndef APT_10_CLEANER_HEADERS
16 #include <apt-pkg/init.h>
17 #endif
18
19 class pkgAcquire;
20 class pkgIndexFile;
21 class debDebPkgFileIndex;
22 class IndexTarget;
23 class pkgCacheGenerator;
24 class OpProgress;
25
26 class APT_HIDDEN debReleaseIndex : public metaIndex {
27 public:
28
29 class debSectionEntry
30 {
31 public:
32 debSectionEntry (std::string const &Section, bool const &IsSrc);
33 std::string const Section;
34 bool const IsSrc;
35 };
36
37 private:
38 /** \brief dpointer placeholder (for later in case we need it) */
39 void *d;
40 std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
41 enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
42
43 public:
44
45 debReleaseIndex(std::string const &URI, std::string const &Dist);
46 debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
47 virtual ~debReleaseIndex();
48
49 virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
50 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
51 virtual std::vector<IndexTarget> GetIndexTargets() const;
52
53 virtual std::string Describe() const;
54 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
55 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
56
57 std::string MetaIndexInfo(const char *Type) const;
58 std::string MetaIndexFile(const char *Types) const;
59 std::string MetaIndexURI(const char *Type) const;
60
61 #if APT_PKG_ABI >= 413
62 virtual
63 #endif
64 std::string LocalFileName() const;
65
66 virtual std::vector <pkgIndexFile *> *GetIndexFiles();
67
68 void SetTrusted(bool const Trusted);
69 virtual bool IsTrusted() const;
70
71 void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
72 void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
73 };
74
75 class APT_HIDDEN debDebFileMetaIndex : public metaIndex
76 {
77 private:
78 std::string DebFile;
79 debDebPkgFileIndex *DebIndex;
80 public:
81 virtual std::string ArchiveURI(std::string const& /*File*/) const {
82 return DebFile;
83 }
84 virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) const {
85 return true;
86 }
87 virtual std::vector<IndexTarget> GetIndexTargets() const {
88 return std::vector<IndexTarget>();
89 }
90 virtual std::vector<pkgIndexFile *> *GetIndexFiles() {
91 return Indexes;
92 }
93 virtual bool IsTrusted() const {
94 return true;
95 }
96 debDebFileMetaIndex(std::string const &DebFile);
97 virtual ~debDebFileMetaIndex() {};
98
99 };
100
101 #endif