You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

171 lines
4.7 KiB

  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 APT_HIDDEN debStatusIndex : public pkgIndexFile
  23. {
  24. protected:
  25. std::string File;
  26. public:
  27. virtual const Type *GetType() const APT_CONST;
  28. // Interface for acquire
  29. virtual std::string Describe(bool /*Short*/) const {return File;};
  30. // Interface for the Cache Generator
  31. virtual bool Exists() const;
  32. virtual bool HasPackages() const {return true;};
  33. virtual unsigned long Size() const;
  34. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  35. bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
  36. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  37. debStatusIndex(std::string File);
  38. virtual ~debStatusIndex();
  39. };
  40. class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
  41. {
  42. public:
  43. virtual const Type *GetType() const APT_CONST;
  44. // Stuff for accessing files on remote items
  45. virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
  46. // Interface for the Cache Generator
  47. virtual bool HasPackages() const {return true;};
  48. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  49. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  50. debPackagesIndex(IndexTarget const &Target, bool const Trusted);
  51. virtual ~debPackagesIndex();
  52. };
  53. class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
  54. {
  55. public:
  56. virtual const Type *GetType() const APT_CONST;
  57. // Interface for the Cache Generator
  58. virtual bool HasPackages() const;
  59. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  60. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  61. debTranslationsIndex(IndexTarget const &Target);
  62. virtual ~debTranslationsIndex();
  63. };
  64. class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
  65. {
  66. public:
  67. virtual const Type *GetType() const APT_CONST;
  68. // Stuff for accessing files on remote items
  69. virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
  70. pkgSrcRecords::File const &File) const;
  71. // Interface for the record parsers
  72. virtual pkgSrcRecords::Parser *CreateSrcParser() const;
  73. // Interface for the Cache Generator
  74. virtual bool HasPackages() const {return false;};
  75. debSourcesIndex(IndexTarget const &Target, bool const Trusted);
  76. virtual ~debSourcesIndex();
  77. };
  78. class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
  79. {
  80. private:
  81. void *d;
  82. std::string DebFile;
  83. std::string DebFileFullPath;
  84. public:
  85. virtual const Type *GetType() const APT_CONST;
  86. virtual std::string Describe(bool /*Short*/) const {
  87. return DebFile;
  88. }
  89. /** get the control (file) content of the deb file
  90. *
  91. * @param[out] content of the control file
  92. * @param debfile is the filename of the .deb-file
  93. * @return \b true if successful, otherwise \b false.
  94. */
  95. static bool GetContent(std::ostream &content, std::string const &debfile);
  96. // Interface for the Cache Generator
  97. virtual bool Exists() const;
  98. virtual bool HasPackages() const {
  99. return true;
  100. };
  101. virtual unsigned long Size() const;
  102. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  103. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  104. // Interface for acquire
  105. virtual std::string ArchiveURI(std::string /*File*/) const;
  106. debDebPkgFileIndex(std::string DebFile);
  107. virtual ~debDebPkgFileIndex();
  108. };
  109. class APT_HIDDEN debDscFileIndex : public pkgIndexFile
  110. {
  111. private:
  112. std::string DscFile;
  113. public:
  114. virtual const Type *GetType() const APT_CONST;
  115. virtual pkgSrcRecords::Parser *CreateSrcParser() const;
  116. virtual bool Exists() const;
  117. virtual bool HasPackages() const {return false;};
  118. virtual unsigned long Size() const;
  119. virtual std::string Describe(bool /*Short*/) const {
  120. return DscFile;
  121. };
  122. debDscFileIndex(std::string &DscFile);
  123. virtual ~debDscFileIndex() {};
  124. };
  125. class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex
  126. {
  127. public:
  128. virtual const Type *GetType() const APT_CONST;
  129. };
  130. #endif