]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
fix some new compiler warnings reported by gcc-5
[apt.git] / apt-pkg / deb / debindexfile.h
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
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
19 #include <apt-pkg/indexfile.h>
20 #include <apt-pkg/cacheiterators.h>
21 #include <apt-pkg/pkgcache.h>
22 #include <apt-pkg/srcrecords.h>
23
24 #include <string>
25
26 class OpProgress;
27 class pkgAcquire;
28 class pkgCacheGenerator;
29
30
31 class APT_HIDDEN debStatusIndex : public pkgIndexFile
32 {
33 /** \brief dpointer placeholder (for later in case we need it) */
34 void *d;
35
36 protected:
37 std::string File;
38
39 public:
40
41 virtual const Type *GetType() const APT_CONST;
42
43 // Interface for acquire
44 virtual std::string Describe(bool /*Short*/) const {return File;};
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;
50 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
51 bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
52 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
53
54 debStatusIndex(std::string File);
55 virtual ~debStatusIndex();
56 };
57
58 class APT_HIDDEN debPackagesIndex : public pkgIndexFile
59 {
60 /** \brief dpointer placeholder (for later in case we need it) */
61 void *d;
62
63 std::string URI;
64 std::string Dist;
65 std::string Section;
66 std::string Architecture;
67
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
72 public:
73
74 virtual const Type *GetType() const APT_CONST;
75
76 // Stuff for accessing files on remote items
77 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
78 virtual std::string ArchiveURI(std::string File) const {return URI + File;};
79
80 // Interface for acquire
81 virtual std::string Describe(bool Short) const;
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;
87 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
88 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
89
90 debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section,
91 bool const &Trusted, std::string const &Arch = "native");
92 virtual ~debPackagesIndex();
93 };
94
95 class APT_HIDDEN debTranslationsIndex : public pkgIndexFile
96 {
97 /** \brief dpointer placeholder (for later in case we need it) */
98 void *d;
99
100 std::string URI;
101 std::string Dist;
102 std::string Section;
103 const char * const Language;
104
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;
108
109 APT_HIDDEN std::string TranslationFile() const {return std::string("Translation-").append(Language);};
110
111 public:
112
113 virtual const Type *GetType() const APT_CONST;
114
115 // Interface for acquire
116 virtual std::string Describe(bool Short) const;
117
118 // Interface for the Cache Generator
119 virtual bool Exists() const;
120 virtual bool HasPackages() const;
121 virtual unsigned long Size() const;
122 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
123 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
124
125 debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language);
126 virtual ~debTranslationsIndex();
127 };
128
129 class APT_HIDDEN debSourcesIndex : public pkgIndexFile
130 {
131 /** \brief dpointer placeholder (for later in case we need it) */
132 void *d;
133
134 std::string URI;
135 std::string Dist;
136 std::string Section;
137
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
142 public:
143
144 virtual const Type *GetType() const APT_CONST;
145
146 // Stuff for accessing files on remote items
147 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
148 pkgSrcRecords::File const &File) const;
149 virtual std::string ArchiveURI(std::string File) const {return URI + File;};
150
151 // Interface for acquire
152 virtual std::string Describe(bool Short) const;
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
162 debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted);
163 virtual ~debSourcesIndex();
164 };
165
166 class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
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
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
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);
201 virtual ~debDebPkgFileIndex();
202 };
203
204 class APT_HIDDEN debDscFileIndex : public pkgIndexFile
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
222 class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex
223 {
224 public:
225 virtual const Type *GetType() const APT_CONST;
226 };
227
228 #endif