]>
Commit | Line | Data |
---|---|---|
b2e465d6 AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
7db98ffc | 3 | // $Id: debindexfile.h,v 1.3.2.1 2003/12/24 23:09:17 mdz Exp $ |
b2e465d6 AL |
4 | /* ###################################################################### |
5 | ||
6 | Debian Index Files | |
7 | ||
8 | There are three sorts currently | |
9 | ||
10 | Package files that have File: tags | |
11 | Package files that don't (/var/lib/dpkg/status) | |
12 | Source files | |
13 | ||
14 | ##################################################################### */ | |
15 | /*}}}*/ | |
16 | #ifndef PKGLIB_DEBINDEXFILE_H | |
17 | #define PKGLIB_DEBINDEXFILE_H | |
18 | ||
453b82a3 DK |
19 | #include <apt-pkg/indexfile.h> |
20 | #include <apt-pkg/cacheiterators.h> | |
21 | #include <apt-pkg/pkgcache.h> | |
22 | #include <apt-pkg/srcrecords.h> | |
13500573 | 23 | |
453b82a3 DK |
24 | #include <string> |
25 | ||
26 | class OpProgress; | |
27 | class pkgAcquire; | |
28 | class pkgCacheGenerator; | |
b2e465d6 | 29 | |
b2e465d6 | 30 | |
dce45dbe | 31 | class APT_HIDDEN debStatusIndex : public pkgIndexFile |
b2e465d6 | 32 | { |
ff72bd0d MV |
33 | /** \brief dpointer placeholder (for later in case we need it) */ |
34 | void *d; | |
36b8ebbb | 35 | |
6d38011b | 36 | protected: |
8f3ba4e8 | 37 | std::string File; |
6d38011b | 38 | |
b2e465d6 AL |
39 | public: |
40 | ||
a02db58f | 41 | virtual const Type *GetType() const APT_CONST; |
b2e465d6 AL |
42 | |
43 | // Interface for acquire | |
65512241 | 44 | virtual std::string Describe(bool /*Short*/) const {return File;}; |
b2e465d6 AL |
45 | |
46 | // Interface for the Cache Generator | |
47 | virtual bool Exists() const; | |
48 | virtual bool HasPackages() const {return true;}; | |
49 | virtual unsigned long Size() const; | |
2e5f4e45 | 50 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; |
6d38011b | 51 | bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const; |
b2e465d6 AL |
52 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; |
53 | ||
8f3ba4e8 | 54 | debStatusIndex(std::string File); |
862bafea | 55 | virtual ~debStatusIndex(); |
b2e465d6 AL |
56 | }; |
57 | ||
dce45dbe | 58 | class APT_HIDDEN debPackagesIndex : public pkgIndexFile |
b2e465d6 | 59 | { |
ff72bd0d MV |
60 | /** \brief dpointer placeholder (for later in case we need it) */ |
61 | void *d; | |
62 | ||
8f3ba4e8 DK |
63 | std::string URI; |
64 | std::string Dist; | |
65 | std::string Section; | |
66 | std::string Architecture; | |
7db98ffc | 67 | |
3809194b DK |
68 | APT_HIDDEN std::string Info(const char *Type) const; |
69 | APT_HIDDEN std::string IndexFile(const char *Type) const; | |
70 | APT_HIDDEN std::string IndexURI(const char *Type) const; | |
71 | ||
b2e465d6 AL |
72 | public: |
73 | ||
a02db58f | 74 | virtual const Type *GetType() const APT_CONST; |
b2e465d6 AL |
75 | |
76 | // Stuff for accessing files on remote items | |
8f3ba4e8 DK |
77 | virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; |
78 | virtual std::string ArchiveURI(std::string File) const {return URI + File;}; | |
b2e465d6 AL |
79 | |
80 | // Interface for acquire | |
8f3ba4e8 | 81 | virtual std::string Describe(bool Short) const; |
b2e465d6 AL |
82 | |
83 | // Interface for the Cache Generator | |
84 | virtual bool Exists() const; | |
85 | virtual bool HasPackages() const {return true;}; | |
86 | virtual unsigned long Size() const; | |
2e5f4e45 | 87 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; |
b2e465d6 | 88 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; |
7db98ffc | 89 | |
8f3ba4e8 DK |
90 | debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section, |
91 | bool const &Trusted, std::string const &Arch = "native"); | |
862bafea | 92 | virtual ~debPackagesIndex(); |
b2e465d6 AL |
93 | }; |
94 | ||
dce45dbe | 95 | class APT_HIDDEN debTranslationsIndex : public pkgIndexFile |
a52f938b | 96 | { |
ff72bd0d MV |
97 | /** \brief dpointer placeholder (for later in case we need it) */ |
98 | void *d; | |
99 | ||
8f3ba4e8 DK |
100 | std::string URI; |
101 | std::string Dist; | |
102 | std::string Section; | |
45df0ad2 | 103 | const char * const Language; |
a52f938b | 104 | |
3809194b DK |
105 | APT_HIDDEN std::string Info(const char *Type) const; |
106 | APT_HIDDEN std::string IndexFile(const char *Type) const; | |
107 | APT_HIDDEN std::string IndexURI(const char *Type) const; | |
a52f938b | 108 | |
3809194b | 109 | APT_HIDDEN std::string TranslationFile() const {return std::string("Translation-").append(Language);}; |
a52f938b OS |
110 | |
111 | public: | |
112 | ||
a02db58f | 113 | virtual const Type *GetType() const APT_CONST; |
a52f938b OS |
114 | |
115 | // Interface for acquire | |
8f3ba4e8 | 116 | virtual std::string Describe(bool Short) const; |
a52f938b OS |
117 | |
118 | // Interface for the Cache Generator | |
119 | virtual bool Exists() const; | |
11680bfd | 120 | virtual bool HasPackages() const; |
a52f938b | 121 | virtual unsigned long Size() const; |
2e5f4e45 | 122 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; |
c51c6f08 | 123 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; |
a52f938b | 124 | |
8f3ba4e8 | 125 | debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language); |
862bafea | 126 | virtual ~debTranslationsIndex(); |
a52f938b OS |
127 | }; |
128 | ||
dce45dbe | 129 | class APT_HIDDEN debSourcesIndex : public pkgIndexFile |
b2e465d6 | 130 | { |
ff72bd0d MV |
131 | /** \brief dpointer placeholder (for later in case we need it) */ |
132 | void *d; | |
133 | ||
8f3ba4e8 DK |
134 | std::string URI; |
135 | std::string Dist; | |
136 | std::string Section; | |
b2e465d6 | 137 | |
3809194b DK |
138 | APT_HIDDEN std::string Info(const char *Type) const; |
139 | APT_HIDDEN std::string IndexFile(const char *Type) const; | |
140 | APT_HIDDEN std::string IndexURI(const char *Type) const; | |
141 | ||
b2e465d6 AL |
142 | public: |
143 | ||
a02db58f | 144 | virtual const Type *GetType() const APT_CONST; |
b2e465d6 AL |
145 | |
146 | // Stuff for accessing files on remote items | |
8f3ba4e8 | 147 | virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, |
b2e465d6 | 148 | pkgSrcRecords::File const &File) const; |
8f3ba4e8 | 149 | virtual std::string ArchiveURI(std::string File) const {return URI + File;}; |
b2e465d6 AL |
150 | |
151 | // Interface for acquire | |
8f3ba4e8 | 152 | virtual std::string Describe(bool Short) const; |
b2e465d6 AL |
153 | |
154 | // Interface for the record parsers | |
155 | virtual pkgSrcRecords::Parser *CreateSrcParser() const; | |
156 | ||
157 | // Interface for the Cache Generator | |
158 | virtual bool Exists() const; | |
159 | virtual bool HasPackages() const {return false;}; | |
160 | virtual unsigned long Size() const; | |
161 | ||
8f3ba4e8 | 162 | debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted); |
862bafea | 163 | virtual ~debSourcesIndex(); |
b2e465d6 AL |
164 | }; |
165 | ||
dce45dbe | 166 | class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile |
0d29b9d4 MV |
167 | { |
168 | private: | |
169 | void *d; | |
170 | std::string DebFile; | |
171 | std::string DebFileFullPath; | |
172 | ||
173 | public: | |
174 | virtual const Type *GetType() const APT_CONST; | |
175 | ||
176 | virtual std::string Describe(bool /*Short*/) const { | |
177 | return DebFile; | |
178 | } | |
179 | ||
2f6a2fbb DK |
180 | /** get the control (file) content of the deb file |
181 | * | |
182 | * @param[out] content of the control file | |
183 | * @param debfile is the filename of the .deb-file | |
184 | * @return \b true if successful, otherwise \b false. | |
185 | */ | |
186 | static bool GetContent(std::ostream &content, std::string const &debfile); | |
187 | ||
0d29b9d4 MV |
188 | // Interface for the Cache Generator |
189 | virtual bool Exists() const; | |
190 | virtual bool HasPackages() const { | |
191 | return true; | |
192 | }; | |
193 | virtual unsigned long Size() const; | |
194 | virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; | |
195 | virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; | |
196 | ||
197 | // Interface for acquire | |
198 | virtual std::string ArchiveURI(std::string /*File*/) const; | |
199 | ||
200 | debDebPkgFileIndex(std::string DebFile); | |
862bafea DK |
201 | virtual ~debDebPkgFileIndex(); |
202 | }; | |
070536e6 | 203 | |
dce45dbe | 204 | class APT_HIDDEN debDscFileIndex : public pkgIndexFile |
a49e7948 MV |
205 | { |
206 | private: | |
207 | std::string DscFile; | |
208 | public: | |
209 | virtual const Type *GetType() const APT_CONST; | |
210 | virtual pkgSrcRecords::Parser *CreateSrcParser() const; | |
211 | virtual bool Exists() const; | |
212 | virtual bool HasPackages() const {return false;}; | |
213 | virtual unsigned long Size() const; | |
214 | virtual std::string Describe(bool /*Short*/) const { | |
215 | return DscFile; | |
216 | }; | |
217 | ||
218 | debDscFileIndex(std::string &DscFile); | |
219 | virtual ~debDscFileIndex() {}; | |
220 | }; | |
221 | ||
dce45dbe | 222 | class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex |
77da39b9 | 223 | { |
3809194b | 224 | public: |
77da39b9 | 225 | virtual const Type *GetType() const APT_CONST; |
0d29b9d4 MV |
226 | }; |
227 | ||
b2e465d6 | 228 | #endif |