debindexfile.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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. #include <apt-pkg/cacheiterators.h>
  16. #include <apt-pkg/pkgcache.h>
  17. #include <apt-pkg/srcrecords.h>
  18. #include <string>
  19. class OpProgress;
  20. class pkgAcquire;
  21. class pkgCacheGenerator;
  22. class debStatusIndex : public pkgIndexFile
  23. {
  24. /** \brief dpointer placeholder (for later in case we need it) */
  25. void *d;
  26. protected:
  27. std::string File;
  28. public:
  29. virtual const Type *GetType() const APT_CONST;
  30. // Interface for acquire
  31. virtual std::string Describe(bool /*Short*/) const {return File;};
  32. // Interface for the Cache Generator
  33. virtual bool Exists() const;
  34. virtual bool HasPackages() const {return true;};
  35. virtual unsigned long Size() const;
  36. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  37. bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
  38. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  39. debStatusIndex(std::string File);
  40. virtual ~debStatusIndex() {};
  41. };
  42. class debPackagesIndex : public pkgIndexFile
  43. {
  44. /** \brief dpointer placeholder (for later in case we need it) */
  45. void *d;
  46. std::string URI;
  47. std::string Dist;
  48. std::string Section;
  49. std::string Architecture;
  50. std::string Info(const char *Type) const;
  51. std::string IndexFile(const char *Type) const;
  52. std::string IndexURI(const char *Type) const;
  53. public:
  54. virtual const Type *GetType() const APT_CONST;
  55. // Stuff for accessing files on remote items
  56. virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
  57. virtual std::string ArchiveURI(std::string File) const {return URI + File;};
  58. // Interface for acquire
  59. virtual std::string Describe(bool Short) const;
  60. // Interface for the Cache Generator
  61. virtual bool Exists() const;
  62. virtual bool HasPackages() const {return true;};
  63. virtual unsigned long Size() const;
  64. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  65. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  66. debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section,
  67. bool const &Trusted, std::string const &Arch = "native");
  68. virtual ~debPackagesIndex() {};
  69. };
  70. class debTranslationsIndex : public pkgIndexFile
  71. {
  72. /** \brief dpointer placeholder (for later in case we need it) */
  73. void *d;
  74. std::string URI;
  75. std::string Dist;
  76. std::string Section;
  77. const char * const Language;
  78. std::string Info(const char *Type) const;
  79. std::string IndexFile(const char *Type) const;
  80. std::string IndexURI(const char *Type) const;
  81. inline std::string TranslationFile() const {return std::string("Translation-").append(Language);};
  82. public:
  83. virtual const Type *GetType() const APT_CONST;
  84. // Interface for acquire
  85. virtual std::string Describe(bool Short) const;
  86. virtual bool GetIndexes(pkgAcquire *Owner) const;
  87. // Interface for the Cache Generator
  88. virtual bool Exists() const;
  89. virtual bool HasPackages() const;
  90. virtual unsigned long Size() const;
  91. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  92. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  93. debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language);
  94. virtual ~debTranslationsIndex() {};
  95. };
  96. class debSourcesIndex : public pkgIndexFile
  97. {
  98. /** \brief dpointer placeholder (for later in case we need it) */
  99. void *d;
  100. std::string URI;
  101. std::string Dist;
  102. std::string Section;
  103. std::string Info(const char *Type) const;
  104. std::string IndexFile(const char *Type) const;
  105. std::string IndexURI(const char *Type) const;
  106. public:
  107. virtual const Type *GetType() const APT_CONST;
  108. // Stuff for accessing files on remote items
  109. virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
  110. pkgSrcRecords::File const &File) const;
  111. virtual std::string ArchiveURI(std::string File) const {return URI + File;};
  112. // Interface for acquire
  113. virtual std::string Describe(bool Short) const;
  114. // Interface for the record parsers
  115. virtual pkgSrcRecords::Parser *CreateSrcParser() const;
  116. // Interface for the Cache Generator
  117. virtual bool Exists() const;
  118. virtual bool HasPackages() const {return false;};
  119. virtual unsigned long Size() const;
  120. debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted);
  121. virtual ~debSourcesIndex() {};
  122. };
  123. class debDebPkgFileIndex : public pkgIndexFile
  124. {
  125. private:
  126. void *d;
  127. std::string DebFile;
  128. std::string DebFileFullPath;
  129. public:
  130. virtual const Type *GetType() const APT_CONST;
  131. virtual std::string Describe(bool /*Short*/) const {
  132. return DebFile;
  133. }
  134. // Interface for the Cache Generator
  135. virtual bool Exists() const;
  136. virtual bool HasPackages() const {
  137. return true;
  138. };
  139. virtual unsigned long Size() const;
  140. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  141. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  142. // Interface for acquire
  143. virtual std::string ArchiveURI(std::string /*File*/) const;
  144. debDebPkgFileIndex(std::string DebFile);
  145. virtual ~debDebPkgFileIndex() {};
  146. };
  147. class debDscFileIndex : public pkgIndexFile
  148. {
  149. private:
  150. std::string DscFile;
  151. public:
  152. virtual const Type *GetType() const APT_CONST;
  153. virtual pkgSrcRecords::Parser *CreateSrcParser() const;
  154. virtual bool Exists() const;
  155. virtual bool HasPackages() const {return false;};
  156. virtual unsigned long Size() const;
  157. virtual std::string Describe(bool /*Short*/) const {
  158. return DscFile;
  159. };
  160. debDscFileIndex(std::string &DscFile);
  161. virtual ~debDscFileIndex() {};
  162. };
  163. class debDebianSourceDirIndex : public debDscFileIndex
  164. {
  165. virtual const Type *GetType() const APT_CONST;
  166. };
  167. #endif