]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
just-in-time creation for (explicit) negative deps
[apt.git] / apt-pkg / deb / debindexfile.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
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
18 #include <apt-pkg/indexfile.h>
19 #include <apt-pkg/cacheiterators.h>
20 #include <apt-pkg/pkgcache.h>
21 #include <apt-pkg/srcrecords.h>
22
23 #include <string>
24
25 class OpProgress;
26 class pkgAcquire;
27 class pkgCacheGenerator;
28
29
30 class APT_HIDDEN debStatusIndex : public pkgIndexFile
31 {
32 void * const d;
33 protected:
34 std::string File;
35
36 public:
37
38 virtual const Type *GetType() const APT_CONST;
39
40 // Interface for acquire
41 virtual std::string Describe(bool /*Short*/) const APT_OVERRIDE {return File;};
42
43 // Interface for the Cache Generator
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;
49
50 debStatusIndex(std::string File);
51 virtual ~debStatusIndex();
52 };
53
54 class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
55 {
56 void * const d;
57 public:
58
59 virtual const Type *GetType() const APT_CONST;
60
61 // Stuff for accessing files on remote items
62 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const APT_OVERRIDE;
63
64 // Interface for the Cache Generator
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;
68
69 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
70 virtual ~debPackagesIndex();
71 };
72
73 class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
74 {
75 void * const d;
76 public:
77
78 virtual const Type *GetType() const APT_CONST;
79
80 // Interface for the Cache Generator
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;
84
85 debTranslationsIndex(IndexTarget const &Target);
86 virtual ~debTranslationsIndex();
87 };
88
89 class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
90 {
91 void * const d;
92 public:
93
94 virtual const Type *GetType() const APT_CONST;
95
96 // Stuff for accessing files on remote items
97 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
98 pkgSrcRecords::File const &File) const APT_OVERRIDE;
99
100 // Interface for the record parsers
101 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
102
103 // Interface for the Cache Generator
104 virtual bool HasPackages() const APT_OVERRIDE {return false;};
105
106 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
107 virtual ~debSourcesIndex();
108 };
109
110 class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
111 {
112 private:
113 void * const d;
114 std::string DebFile;
115 std::string DebFileFullPath;
116
117 public:
118 virtual const Type *GetType() const APT_CONST;
119
120 virtual std::string Describe(bool /*Short*/) const APT_OVERRIDE {
121 return DebFile;
122 }
123
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
132 // Interface for the Cache Generator
133 virtual bool Exists() const APT_OVERRIDE;
134 virtual bool HasPackages() const APT_OVERRIDE {
135 return true;
136 };
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;
140
141 // Interface for acquire
142 virtual std::string ArchiveURI(std::string /*File*/) const APT_OVERRIDE;
143
144 debDebPkgFileIndex(std::string DebFile);
145 virtual ~debDebPkgFileIndex();
146 };
147
148 class APT_HIDDEN debDscFileIndex : public pkgIndexFile
149 {
150 private:
151 void * const d;
152 std::string DscFile;
153 public:
154 virtual const Type *GetType() const APT_CONST;
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 {
160 return DscFile;
161 };
162
163 debDscFileIndex(std::string &DscFile);
164 virtual ~debDscFileIndex();
165 };
166
167 class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex
168 {
169 public:
170 virtual const Type *GetType() const APT_CONST;
171 };
172
173 #endif