]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
02708b558ef0db152ec350dc7dd5c8a6d4c1485d
[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 class debStatusIndex : public pkgDebianIndexRealFile
30 {
31 void * const d;
32 protected:
33 virtual std::string GetArchitecture() const APT_OVERRIDE;
34 virtual std::string GetComponent() const APT_OVERRIDE;
35 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
36
37 public:
38
39 virtual const Type *GetType() const APT_CONST;
40
41 // Interface for the Cache Generator
42 virtual bool HasPackages() const APT_OVERRIDE {return true;};
43 // Abort if the file does not exist.
44 virtual bool Exists() const APT_OVERRIDE {return true;};
45
46 debStatusIndex(std::string const &File);
47 virtual ~debStatusIndex();
48 };
49
50 class debPackagesIndex : public pkgDebianIndexTargetFile
51 {
52 void * const d;
53 protected:
54 virtual uint8_t GetIndexFlags() const;
55
56 public:
57 virtual const Type *GetType() const APT_CONST;
58
59 // Stuff for accessing files on remote items
60 virtual std::string ArchiveInfo(pkgCache::VerIterator const &Ver) const APT_OVERRIDE;
61
62 // Interface for the Cache Generator
63 virtual bool HasPackages() const APT_OVERRIDE {return true;};
64
65 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
66 virtual ~debPackagesIndex();
67 };
68
69 class debTranslationsIndex : public pkgDebianIndexTargetFile
70 {
71 void * const d;
72 protected:
73 virtual std::string GetArchitecture() const APT_OVERRIDE;
74 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
75 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
76 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
77
78 public:
79
80 virtual const Type *GetType() const APT_CONST;
81
82 // Interface for the Cache Generator
83 virtual bool HasPackages() const APT_OVERRIDE;
84
85 debTranslationsIndex(IndexTarget const &Target);
86 virtual ~debTranslationsIndex();
87 };
88
89 class debSourcesIndex : public pkgDebianIndexTargetFile
90 {
91 void * const d;
92 virtual uint8_t GetIndexFlags() const;
93 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
94 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
95
96 public:
97
98 virtual const Type *GetType() const APT_CONST;
99
100 // Stuff for accessing files on remote items
101 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
102 pkgSrcRecords::File const &File) const APT_OVERRIDE;
103
104 // Interface for the record parsers
105 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
106
107 // Interface for the Cache Generator
108 virtual bool HasPackages() const APT_OVERRIDE {return false;};
109
110 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
111 virtual ~debSourcesIndex();
112 };
113
114 class debDebPkgFileIndex : public pkgDebianIndexRealFile
115 {
116 void * const d;
117 std::string DebFile;
118
119 protected:
120 virtual std::string GetComponent() const APT_OVERRIDE;
121 virtual std::string GetArchitecture() const APT_OVERRIDE;
122 virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
123 virtual bool OpenListFile(FileFd &Pkg, std::string const &FileName) APT_OVERRIDE;
124 APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
125
126 public:
127 virtual const Type *GetType() const APT_CONST;
128
129 /** get the control (file) content of the deb file
130 *
131 * @param[out] content of the control file
132 * @param debfile is the filename of the .deb-file
133 * @return \b true if successful, otherwise \b false.
134 */
135 static bool GetContent(std::ostream &content, std::string const &debfile);
136
137 // Interface for the Cache Generator
138 virtual bool HasPackages() const APT_OVERRIDE {return true;}
139 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const APT_OVERRIDE;
140
141 // Interface for acquire
142
143 debDebPkgFileIndex(std::string const &DebFile);
144 virtual ~debDebPkgFileIndex();
145 };
146
147 class debDscFileIndex : public pkgDebianIndexRealFile
148 {
149 void * const d;
150 public:
151 virtual const Type *GetType() const APT_CONST;
152 virtual pkgSrcRecords::Parser *CreateSrcParser() const APT_OVERRIDE;
153 virtual bool HasPackages() const APT_OVERRIDE {return false;};
154
155 debDscFileIndex(std::string const &DscFile);
156 virtual ~debDscFileIndex();
157 };
158
159 class debDebianSourceDirIndex : public debDscFileIndex
160 {
161 public:
162 virtual const Type *GetType() const APT_CONST;
163 };
164
165 #endif