debindexfile.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. protected:
  18. string File;
  19. public:
  20. virtual const Type *GetType() const;
  21. // Interface for acquire
  22. virtual string Describe(bool Short) const {return File;};
  23. // Interface for the Cache Generator
  24. virtual bool Exists() const;
  25. virtual bool HasPackages() const {return true;};
  26. virtual unsigned long Size() const;
  27. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  28. bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
  29. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  30. debStatusIndex(string File);
  31. };
  32. class debPackagesIndex : public pkgIndexFile
  33. {
  34. string URI;
  35. string Dist;
  36. string Section;
  37. string Architecture;
  38. string Info(const char *Type) const;
  39. string IndexFile(const char *Type) const;
  40. string IndexURI(const char *Type) const;
  41. public:
  42. virtual const Type *GetType() const;
  43. // Stuff for accessing files on remote items
  44. virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
  45. virtual string ArchiveURI(string File) const {return URI + File;};
  46. // Interface for acquire
  47. virtual string Describe(bool Short) const;
  48. // Interface for the Cache Generator
  49. virtual bool Exists() const;
  50. virtual bool HasPackages() const {return true;};
  51. virtual unsigned long Size() const;
  52. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  53. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  54. debPackagesIndex(string const &URI, string const &Dist, string const &Section,
  55. bool const &Trusted, string const &Arch = "native");
  56. };
  57. class debTranslationsIndex : public pkgIndexFile
  58. {
  59. string URI;
  60. string Dist;
  61. string Section;
  62. const char * const Language;
  63. string Info(const char *Type) const;
  64. string IndexFile(const char *Type) const;
  65. string IndexURI(const char *Type) const;
  66. inline string TranslationFile() const {return string("Translation-").append(Language);};
  67. public:
  68. virtual const Type *GetType() const;
  69. // Interface for acquire
  70. virtual string Describe(bool Short) const;
  71. virtual bool GetIndexes(pkgAcquire *Owner) const;
  72. // Interface for the Cache Generator
  73. virtual bool Exists() const;
  74. virtual bool HasPackages() const;
  75. virtual unsigned long Size() const;
  76. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
  77. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  78. debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
  79. };
  80. class debSourcesIndex : public pkgIndexFile
  81. {
  82. string URI;
  83. string Dist;
  84. string Section;
  85. string Info(const char *Type) const;
  86. string IndexFile(const char *Type) const;
  87. string IndexURI(const char *Type) const;
  88. public:
  89. virtual const Type *GetType() const;
  90. // Stuff for accessing files on remote items
  91. virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
  92. pkgSrcRecords::File const &File) const;
  93. virtual string ArchiveURI(string File) const {return URI + File;};
  94. // Interface for acquire
  95. virtual string Describe(bool Short) const;
  96. // Interface for the record parsers
  97. virtual pkgSrcRecords::Parser *CreateSrcParser() const;
  98. // Interface for the Cache Generator
  99. virtual bool Exists() const;
  100. virtual bool HasPackages() const {return false;};
  101. virtual unsigned long Size() const;
  102. debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
  103. };
  104. #endif