]>
Commit | Line | Data |
---|---|---|
b2e465d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
b2e465d6 AL |
3 | /* ###################################################################### |
4 | ||
5 | Debian Index Files | |
6 | ||
7 | There are three sorts currently | |
8 | ||
9 | Package files that have File: tags | |
10 | Package files that don't (/var/lib/dpkg/status) | |
11 | Source files | |
12 | ||
13 | ##################################################################### */ | |
14 | /*}}}*/ | |
15 | #ifndef PKGLIB_DEBINDEXFILE_H | |
16 | #define PKGLIB_DEBINDEXFILE_H | |
17 | ||
453b82a3 DK |
18 | #include <apt-pkg/indexfile.h> |
19 | #include <apt-pkg/cacheiterators.h> | |
20 | #include <apt-pkg/pkgcache.h> | |
21 | #include <apt-pkg/srcrecords.h> | |
13500573 | 22 | |
453b82a3 DK |
23 | #include <string> |
24 | ||
25 | class OpProgress; | |
26 | class pkgAcquire; | |
27 | class pkgCacheGenerator; | |
b2e465d6 | 28 | |
b2e465d6 | 29 | |
dce45dbe | 30 | class APT_HIDDEN debStatusIndex : public pkgIndexFile |
b2e465d6 | 31 | { |
6c55f07a | 32 | void * const d; |
6d38011b | 33 | protected: |
8f3ba4e8 | 34 | std::string File; |
6d38011b | 35 | |
b2e465d6 AL |
36 | public: |
37 | ||
a02db58f | 38 | virtual const Type *GetType() const APT_CONST; |
e3c1cfc7 | 39 | |
b2e465d6 | 40 | // Interface for acquire |
3b302846 | 41 | virtual std::string Describe(bool /*Short*/) const APT_OVERRIDE {return File;}; |
e3c1cfc7 | 42 | |
b2e465d6 | 43 | // Interface for the Cache Generator |
3b302846 DK |
44 | virtual bool Exists() const APT_OVERRIDE; |
45 | virtual bool HasPackages() const APT_OVERRIDE {return true;}; | |
46 | virtual unsigned long Size() const APT_OVERRIDE; | |
47 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE; | |
48 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE; | |
b2e465d6 | 49 | |
8f3ba4e8 | 50 | debStatusIndex(std::string File); |
862bafea | 51 | virtual ~debStatusIndex(); |
b2e465d6 | 52 | }; |
3809194b | 53 | |
e3c1cfc7 DK |
54 | class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile |
55 | { | |
6c55f07a | 56 | void * const d; |
b2e465d6 | 57 | public: |
e3c1cfc7 | 58 | |
a02db58f | 59 | virtual const Type *GetType() const APT_CONST; |
b2e465d6 AL |
60 | |
61 | // Stuff for accessing files on remote items | |
3b302846 | 62 | virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const APT_OVERRIDE; |
e3c1cfc7 | 63 | |
b2e465d6 | 64 | // Interface for the Cache Generator |
3b302846 DK |
65 | virtual bool HasPackages() const APT_OVERRIDE {return true;}; |
66 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE; | |
67 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE; | |
7db98ffc | 68 | |
e3c1cfc7 | 69 | debPackagesIndex(IndexTarget const &Target, bool const Trusted); |
862bafea | 70 | virtual ~debPackagesIndex(); |
b2e465d6 AL |
71 | }; |
72 | ||
e3c1cfc7 | 73 | class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile |
a52f938b | 74 | { |
6c55f07a | 75 | void * const d; |
a52f938b | 76 | public: |
d38926ef | 77 | |
a02db58f | 78 | virtual const Type *GetType() const APT_CONST; |
a52f938b | 79 | |
a52f938b | 80 | // Interface for the Cache Generator |
3b302846 DK |
81 | virtual bool HasPackages() const APT_OVERRIDE; |
82 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE; | |
83 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE; | |
a52f938b | 84 | |
e3c1cfc7 | 85 | debTranslationsIndex(IndexTarget const &Target); |
862bafea | 86 | virtual ~debTranslationsIndex(); |
a52f938b OS |
87 | }; |
88 | ||
e3c1cfc7 | 89 | class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile |
b2e465d6 | 90 | { |
6c55f07a | 91 | void * const d; |
b2e465d6 AL |
92 | public: |
93 | ||
a02db58f | 94 | virtual const Type *GetType() const APT_CONST; |
b2e465d6 AL |
95 | |
96 | // Stuff for accessing files on remote items | |
8f3ba4e8 | 97 | virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, |
3b302846 | 98 | pkgSrcRecords::File const &File) const APT_OVERRIDE; |
b2e465d6 AL |
99 | |
100 | // Interface for the record parsers | |
3b302846 | 101 | virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE; |
e3c1cfc7 | 102 | |
b2e465d6 | 103 | // Interface for the Cache Generator |
3b302846 | 104 | virtual bool HasPackages() const APT_OVERRIDE {return false;}; |
e3c1cfc7 DK |
105 | |
106 | debSourcesIndex(IndexTarget const &Target, bool const Trusted); | |
862bafea | 107 | virtual ~debSourcesIndex(); |
b2e465d6 AL |
108 | }; |
109 | ||
dce45dbe | 110 | class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile |
0d29b9d4 MV |
111 | { |
112 | private: | |
6c55f07a | 113 | void * const d; |
0d29b9d4 MV |
114 | std::string DebFile; |
115 | std::string DebFileFullPath; | |
116 | ||
117 | public: | |
118 | virtual const Type *GetType() const APT_CONST; | |
119 | ||
3b302846 | 120 | virtual std::string Describe(bool /*Short*/) const APT_OVERRIDE { |
0d29b9d4 MV |
121 | return DebFile; |
122 | } | |
123 | ||
2f6a2fbb DK |
124 | /** get the control (file) content of the deb file |
125 | * | |
126 | * @param[out] content of the control file | |
127 | * @param debfile is the filename of the .deb-file | |
128 | * @return \b true if successful, otherwise \b false. | |
129 | */ | |
130 | static bool GetContent(std::ostream &content, std::string const &debfile); | |
131 | ||
0d29b9d4 | 132 | // Interface for the Cache Generator |
3b302846 DK |
133 | virtual bool Exists() const APT_OVERRIDE; |
134 | virtual bool HasPackages() const APT_OVERRIDE { | |
0d29b9d4 MV |
135 | return true; |
136 | }; | |
3b302846 DK |
137 | virtual unsigned long Size() const APT_OVERRIDE; |
138 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE; | |
139 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE; | |
0d29b9d4 MV |
140 | |
141 | // Interface for acquire | |
3b302846 | 142 | virtual std::string ArchiveURI(std::string /*File*/) const APT_OVERRIDE; |
0d29b9d4 MV |
143 | |
144 | debDebPkgFileIndex(std::string DebFile); | |
862bafea DK |
145 | virtual ~debDebPkgFileIndex(); |
146 | }; | |
070536e6 | 147 | |
dce45dbe | 148 | class APT_HIDDEN debDscFileIndex : public pkgIndexFile |
a49e7948 MV |
149 | { |
150 | private: | |
6c55f07a | 151 | void * const d; |
a49e7948 MV |
152 | std::string DscFile; |
153 | public: | |
154 | virtual const Type *GetType() const APT_CONST; | |
3b302846 DK |
155 | virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE; |
156 | virtual bool Exists() const APT_OVERRIDE; | |
157 | virtual bool HasPackages() const APT_OVERRIDE {return false;}; | |
158 | virtual unsigned long Size() const APT_OVERRIDE; | |
159 | virtual std::string Describe(bool /*Short*/) const APT_OVERRIDE { | |
a49e7948 MV |
160 | return DscFile; |
161 | }; | |
162 | ||
163 | debDscFileIndex(std::string &DscFile); | |
c8a4ce6c | 164 | virtual ~debDscFileIndex(); |
a49e7948 MV |
165 | }; |
166 | ||
dce45dbe | 167 | class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex |
77da39b9 | 168 | { |
3809194b | 169 | public: |
77da39b9 | 170 | virtual const Type *GetType() const APT_CONST; |
0d29b9d4 MV |
171 | }; |
172 | ||
b2e465d6 | 173 | #endif |