debindexfile.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: debindexfile.h,v 1.3.2.1 2003/12/24 23:09:17 mdz Exp $
  4. /* ######################################################################
  5. Debian Index Files
  6. There are three sorts currently
  7. Package files that have File: tags
  8. Package files that don't (/var/lib/dpkg/status)
  9. Source files
  10. ##################################################################### */
  11. /*}}}*/
  12. #ifndef PKGLIB_DEBINDEXFILE_H
  13. #define PKGLIB_DEBINDEXFILE_H
  14. #include <apt-pkg/indexfile.h>
  15. class debStatusIndex : public pkgIndexFile
  16. {
  17. /** \brief dpointer placeholder (for later in case we need it) */
  18. void *d;
  19. protected:
  20. std::string File;
  21. public:
  22. virtual const Type *GetType() const;
  23. // Interface for acquire
  24. virtual std::string Describe(bool Short) const {return File;};
  25. // Interface for the Cache Generator
  26. virtual bool Exists() const;
  27. virtual bool HasPackages() const {return true;};
  28. virtual unsigned long Size() const;
  29. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  30. bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
  31. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  32. debStatusIndex(std::string File);
  33. virtual ~debStatusIndex() {};
  34. };
  35. class debPackagesIndex : public pkgIndexFile
  36. {
  37. /** \brief dpointer placeholder (for later in case we need it) */
  38. void *d;
  39. std::string URI;
  40. std::string Dist;
  41. std::string Section;
  42. std::string Architecture;
  43. std::string Info(const char *Type) const;
  44. std::string IndexFile(const char *Type) const;
  45. std::string IndexURI(const char *Type) const;
  46. public:
  47. virtual const Type *GetType() const;
  48. // Stuff for accessing files on remote items
  49. virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
  50. virtual std::string ArchiveURI(std::string File) const {return URI + File;};
  51. // Interface for acquire
  52. virtual std::string Describe(bool Short) const;
  53. // Interface for the Cache Generator
  54. virtual bool Exists() const;
  55. virtual bool HasPackages() const {return true;};
  56. virtual unsigned long Size() const;
  57. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  58. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  59. debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section,
  60. bool const &Trusted, std::string const &Arch = "native");
  61. virtual ~debPackagesIndex() {};
  62. };
  63. class debTranslationsIndex : public pkgIndexFile
  64. {
  65. /** \brief dpointer placeholder (for later in case we need it) */
  66. void *d;
  67. std::string URI;
  68. std::string Dist;
  69. std::string Section;
  70. const char * const Language;
  71. std::string Info(const char *Type) const;
  72. std::string IndexFile(const char *Type) const;
  73. std::string IndexURI(const char *Type) const;
  74. inline std::string TranslationFile() const {return std::string("Translation-").append(Language);};
  75. public:
  76. virtual const Type *GetType() const;
  77. // Interface for acquire
  78. virtual std::string Describe(bool Short) const;
  79. virtual bool GetIndexes(pkgAcquire *Owner) const;
  80. // Interface for the Cache Generator
  81. virtual bool Exists() const;
  82. virtual bool HasPackages() const;
  83. virtual unsigned long Size() const;
  84. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  85. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  86. debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language);
  87. virtual ~debTranslationsIndex() {};
  88. };
  89. class debSourcesIndex : public pkgIndexFile
  90. {
  91. /** \brief dpointer placeholder (for later in case we need it) */
  92. void *d;
  93. std::string URI;
  94. std::string Dist;
  95. std::string Section;
  96. std::string Info(const char *Type) const;
  97. std::string IndexFile(const char *Type) const;
  98. std::string IndexURI(const char *Type) const;
  99. public:
  100. virtual const Type *GetType() const;
  101. // Stuff for accessing files on remote items
  102. virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
  103. pkgSrcRecords::File const &File) const;
  104. virtual std::string ArchiveURI(std::string File) const {return URI + File;};
  105. // Interface for acquire
  106. virtual std::string Describe(bool Short) const;
  107. // Interface for the record parsers
  108. virtual pkgSrcRecords::Parser *CreateSrcParser() const;
  109. // Interface for the Cache Generator
  110. virtual bool Exists() const;
  111. virtual bool HasPackages() const {return false;};
  112. virtual unsigned long Size() const;
  113. debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted);
  114. virtual ~debSourcesIndex() {};
  115. };
  116. #endif