]>
Commit | Line | Data |
---|---|---|
b3d44315 MV |
1 | // ijones, walters |
2 | #ifndef PKGLIB_DEBMETAINDEX_H | |
3 | #define PKGLIB_DEBMETAINDEX_H | |
4 | ||
b3d44315 | 5 | #include <apt-pkg/metaindex.h> |
453b82a3 | 6 | #include <apt-pkg/macros.h> |
b3d44315 | 7 | |
5dd4c8b8 | 8 | #include <map> |
472ff00e DK |
9 | #include <string> |
10 | #include <vector> | |
5dd4c8b8 | 11 | |
b9dadc24 DK |
12 | #ifndef APT_8_CLEANER_HEADERS |
13 | #include <apt-pkg/sourcelist.h> | |
14 | #endif | |
453b82a3 DK |
15 | #ifndef APT_10_CLEANER_HEADERS |
16 | #include <apt-pkg/init.h> | |
17 | #endif | |
18 | ||
19 | class pkgAcquire; | |
20 | class pkgIndexFile; | |
0d29b9d4 | 21 | class debDebPkgFileIndex; |
80624be7 | 22 | class IndexTarget; |
b9dadc24 | 23 | |
b3d44315 MV |
24 | class debReleaseIndex : public metaIndex { |
25 | public: | |
26 | ||
27 | class debSectionEntry | |
28 | { | |
29 | public: | |
472ff00e DK |
30 | debSectionEntry (std::string const &Section, bool const &IsSrc); |
31 | std::string const Section; | |
5dd4c8b8 | 32 | bool const IsSrc; |
b3d44315 MV |
33 | }; |
34 | ||
35 | private: | |
ff72bd0d MV |
36 | /** \brief dpointer placeholder (for later in case we need it) */ |
37 | void *d; | |
472ff00e | 38 | std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries; |
4b42f43b | 39 | enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted; |
b3d44315 MV |
40 | |
41 | public: | |
42 | ||
472ff00e DK |
43 | debReleaseIndex(std::string const &URI, std::string const &Dist); |
44 | debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted); | |
ff72bd0d | 45 | virtual ~debReleaseIndex(); |
b3d44315 | 46 | |
472ff00e | 47 | virtual std::string ArchiveURI(std::string const &File) const {return URI + File;}; |
5dd4c8b8 | 48 | virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const; |
80624be7 | 49 | std::vector <IndexTarget *>* ComputeIndexTargets() const; |
472ff00e | 50 | std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const; |
7014e148 | 51 | |
472ff00e DK |
52 | std::string MetaIndexInfo(const char *Type) const; |
53 | std::string MetaIndexFile(const char *Types) const; | |
54 | std::string MetaIndexURI(const char *Type) const; | |
7014e148 MV |
55 | |
56 | #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) | |
57 | virtual std::string LocalFileName() const; | |
58 | #endif | |
59 | ||
472ff00e DK |
60 | std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const; |
61 | std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const; | |
62 | std::string SourceIndexURI(const char *Type, const std::string &Section) const; | |
63 | std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const; | |
64 | std::string TranslationIndexURI(const char *Type, const std::string &Section) const; | |
65 | std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const; | |
66 | virtual std::vector <pkgIndexFile *> *GetIndexFiles(); | |
b3d44315 | 67 | |
4b42f43b | 68 | void SetTrusted(bool const Trusted); |
b3d44315 MV |
69 | virtual bool IsTrusted() const; |
70 | ||
472ff00e DK |
71 | void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry); |
72 | void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry); | |
b3d44315 MV |
73 | void PushSectionEntry(const debSectionEntry *Entry); |
74 | }; | |
75 | ||
0d29b9d4 MV |
76 | class debDebFileMetaIndex : public metaIndex |
77 | { | |
78 | private: | |
79 | std::string DebFile; | |
80 | debDebPkgFileIndex *DebIndex; | |
81 | public: | |
82 | virtual std::string ArchiveURI(std::string const& /*File*/) const { | |
83 | return DebFile; | |
84 | } | |
85 | virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) const { | |
86 | return true; | |
87 | } | |
88 | virtual std::vector<pkgIndexFile *> *GetIndexFiles() { | |
89 | return Indexes; | |
90 | } | |
91 | virtual bool IsTrusted() const { | |
92 | return true; | |
93 | } | |
94 | debDebFileMetaIndex(std::string const &DebFile); | |
95 | virtual ~debDebFileMetaIndex() {}; | |
96 | ||
97 | }; | |
98 | ||
b3d44315 | 99 | #endif |