debmetaindex.h 2.5 KB

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