debmetaindex.h 3.1 KB

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