debmetaindex.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 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 { 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_MAJOR >= 4 && APT_PKG_MINOR >= 13)
  45. virtual std::string LocalFileName() const;
  46. #endif
  47. std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
  48. std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
  49. std::string SourceIndexURI(const char *Type, const std::string &Section) const;
  50. std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const;
  51. std::string TranslationIndexURI(const char *Type, const std::string &Section) const;
  52. std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const;
  53. virtual std::vector <pkgIndexFile *> *GetIndexFiles();
  54. void SetTrusted(bool const Trusted);
  55. virtual bool IsTrusted() const;
  56. void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
  57. void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
  58. void PushSectionEntry(const debSectionEntry *Entry);
  59. };
  60. class debDebFileMetaIndex : public metaIndex
  61. {
  62. private:
  63. std::string DebFile;
  64. debDebPkgFileIndex *DebIndex;
  65. public:
  66. virtual std::string ArchiveURI(std::string const& /*File*/) const {
  67. return DebFile;
  68. }
  69. virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) const {
  70. return true;
  71. }
  72. virtual std::vector<pkgIndexFile *> *GetIndexFiles() {
  73. return Indexes;
  74. }
  75. virtual bool IsTrusted() const {
  76. return true;
  77. }
  78. debDebFileMetaIndex(std::string const &DebFile);
  79. virtual ~debDebFileMetaIndex() {};
  80. };
  81. #endif