| 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 | |
| 22 | class debReleaseIndex : public metaIndex { |
| 23 | public: |
| 24 | |
| 25 | class debSectionEntry |
| 26 | { |
| 27 | public: |
| 28 | debSectionEntry (std::string const &Section, bool const &IsSrc); |
| 29 | std::string const Section; |
| 30 | bool const IsSrc; |
| 31 | }; |
| 32 | |
| 33 | private: |
| 34 | /** \brief dpointer placeholder (for later in case we need it) */ |
| 35 | void *d; |
| 36 | std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries; |
| 37 | enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted; |
| 38 | |
| 39 | public: |
| 40 | |
| 41 | debReleaseIndex(std::string const &URI, std::string const &Dist); |
| 42 | debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted); |
| 43 | virtual ~debReleaseIndex(); |
| 44 | |
| 45 | virtual std::string ArchiveURI(std::string const &File) const {return URI + File;}; |
| 46 | virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const; |
| 47 | std::vector <struct IndexTarget *>* ComputeIndexTargets() const; |
| 48 | std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const; |
| 49 | |
| 50 | std::string MetaIndexInfo(const char *Type) const; |
| 51 | std::string MetaIndexFile(const char *Types) const; |
| 52 | std::string MetaIndexURI(const char *Type) const; |
| 53 | |
| 54 | #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) |
| 55 | virtual std::string LocalFileName() const; |
| 56 | #endif |
| 57 | |
| 58 | std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const; |
| 59 | std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const; |
| 60 | std::string SourceIndexURI(const char *Type, const std::string &Section) const; |
| 61 | std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const; |
| 62 | std::string TranslationIndexURI(const char *Type, const std::string &Section) const; |
| 63 | std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const; |
| 64 | virtual std::vector <pkgIndexFile *> *GetIndexFiles(); |
| 65 | |
| 66 | void SetTrusted(bool const Trusted); |
| 67 | virtual bool IsTrusted() const; |
| 68 | |
| 69 | void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry); |
| 70 | void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry); |
| 71 | void PushSectionEntry(const debSectionEntry *Entry); |
| 72 | }; |
| 73 | |
| 74 | #endif |