]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
better non-virtual metaIndex.LocalFileName() implementation
[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 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 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 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 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 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 // Interface for the Cache Generator
181 virtual bool Exists() const;
182 virtual bool HasPackages() const {
183 return true;
184 };
185 virtual unsigned long Size() const;
186 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
187 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
188
189 // Interface for acquire
190 virtual std::string ArchiveURI(std::string /*File*/) const;
191
192 debDebPkgFileIndex(std::string DebFile);
193 virtual ~debDebPkgFileIndex();
194 };
195
196 class debDscFileIndex : public pkgIndexFile
197 {
198 private:
199 std::string DscFile;
200 public:
201 virtual const Type *GetType() const APT_CONST;
202 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
203 virtual bool Exists() const;
204 virtual bool HasPackages() const {return false;};
205 virtual unsigned long Size() const;
206 virtual std::string Describe(bool /*Short*/) const {
207 return DscFile;
208 };
209
210 debDscFileIndex(std::string &DscFile);
211 virtual ~debDscFileIndex() {};
212 };
213
214 class debDebianSourceDirIndex : public debDscFileIndex
215 {
216 public:
217 virtual const Type *GetType() const APT_CONST;
218 };
219
220 #endif