]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debmetaindex.h
better non-virtual metaIndex.LocalFileName() implementation
[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
24 class debReleaseIndex : public metaIndex {
25 public:
26
27 class debSectionEntry
28 {
29 public:
30 debSectionEntry (std::string const &Section, bool const &IsSrc);
31 std::string const Section;
32 bool const IsSrc;
33 };
34
35 private:
36 /** \brief dpointer placeholder (for later in case we need it) */
37 void *d;
38 std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
39 enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
40
41 public:
42
43 debReleaseIndex(std::string const &URI, std::string const &Dist);
44 debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
45 virtual ~debReleaseIndex();
46
47 virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
48 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
49 std::vector <IndexTarget *>* ComputeIndexTargets() const;
50 std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const;
51
52 std::string MetaIndexInfo(const char *Type) const;
53 std::string MetaIndexFile(const char *Types) const;
54 std::string MetaIndexURI(const char *Type) const;
55
56 #if APT_PKG_ABI >= 413
57 virtual
58 #endif
59 std::string LocalFileName() const;
60
61 std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
62 std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
63 std::string SourceIndexURI(const char *Type, const std::string &Section) const;
64 std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const;
65 std::string TranslationIndexURI(const char *Type, const std::string &Section) const;
66 std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const;
67 virtual std::vector <pkgIndexFile *> *GetIndexFiles();
68
69 void SetTrusted(bool const Trusted);
70 virtual bool IsTrusted() const;
71
72 void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
73 void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
74 void PushSectionEntry(const debSectionEntry *Entry);
75 };
76
77 class debDebFileMetaIndex : public metaIndex
78 {
79 private:
80 std::string DebFile;
81 debDebPkgFileIndex *DebIndex;
82 public:
83 virtual std::string ArchiveURI(std::string const& /*File*/) const {
84 return DebFile;
85 }
86 virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) const {
87 return true;
88 }
89 virtual std::vector<pkgIndexFile *> *GetIndexFiles() {
90 return Indexes;
91 }
92 virtual bool IsTrusted() const {
93 return true;
94 }
95 debDebFileMetaIndex(std::string const &DebFile);
96 virtual ~debDebFileMetaIndex() {};
97
98 };
99
100 #endif