debmetaindex.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 pkgCacheGenerator;
  20. class OpProgress;
  21. class APT_HIDDEN debReleaseIndex : public metaIndex {
  22. public:
  23. class debSectionEntry
  24. {
  25. public:
  26. debSectionEntry (std::string const &Section, bool const &IsSrc);
  27. std::string const Section;
  28. bool const IsSrc;
  29. };
  30. private:
  31. /** \brief dpointer placeholder (for later in case we need it) */
  32. void *d;
  33. std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
  34. enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
  35. public:
  36. debReleaseIndex(std::string const &URI, std::string const &Dist);
  37. debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
  38. virtual ~debReleaseIndex();
  39. virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
  40. virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
  41. virtual std::vector<IndexTarget> GetIndexTargets() const;
  42. virtual std::string Describe() const;
  43. virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
  44. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  45. std::string MetaIndexInfo(const char *Type) const;
  46. std::string MetaIndexFile(const char *Types) const;
  47. std::string MetaIndexURI(const char *Type) const;
  48. #if APT_PKG_ABI >= 413
  49. virtual
  50. #endif
  51. std::string LocalFileName() const;
  52. virtual std::vector <pkgIndexFile *> *GetIndexFiles();
  53. void SetTrusted(bool const Trusted);
  54. virtual bool IsTrusted() const;
  55. void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
  56. void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
  57. };
  58. class APT_HIDDEN debDebFileMetaIndex : public metaIndex
  59. {
  60. private:
  61. void *d;
  62. std::string DebFile;
  63. debDebPkgFileIndex *DebIndex;
  64. public:
  65. virtual std::string ArchiveURI(std::string const& /*File*/) const {
  66. return DebFile;
  67. }
  68. virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) const {
  69. return true;
  70. }
  71. virtual std::vector<IndexTarget> GetIndexTargets() const {
  72. return std::vector<IndexTarget>();
  73. }
  74. virtual std::vector<pkgIndexFile *> *GetIndexFiles() {
  75. return Indexes;
  76. }
  77. virtual bool IsTrusted() const {
  78. return true;
  79. }
  80. debDebFileMetaIndex(std::string const &DebFile);
  81. virtual ~debDebFileMetaIndex();
  82. };
  83. #endif