]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
apply various style suggestions by cppcheck
[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 *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 {return File;};
42
43 // Interface for the Cache Generator
44 virtual bool Exists() const;
45 virtual bool HasPackages() const {return true;};
46 virtual unsigned long Size() const;
47 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
48 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
49
50 debStatusIndex(std::string File);
51 virtual ~debStatusIndex();
52 };
53
54 class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
55 {
56 void *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;
63
64 // Interface for the Cache Generator
65 virtual bool HasPackages() const {return true;};
66 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
67 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
68
69 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
70 virtual ~debPackagesIndex();
71 };
72
73 class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
74 {
75 void *d;
76 public:
77
78 virtual const Type *GetType() const APT_CONST;
79
80 // Interface for the Cache Generator
81 virtual bool HasPackages() const;
82 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
83 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
84
85 debTranslationsIndex(IndexTarget const &Target);
86 virtual ~debTranslationsIndex();
87 };
88
89 class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
90 {
91 void *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;
99
100 // Interface for the record parsers
101 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
102
103 // Interface for the Cache Generator
104 virtual bool HasPackages() const {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 *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 {
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;
134 virtual bool HasPackages() const {
135 return true;
136 };
137 virtual unsigned long Size() const;
138 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
139 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
140
141 // Interface for acquire
142 virtual std::string ArchiveURI(std::string /*File*/) const;
143
144 debDebPkgFileIndex(std::string DebFile);
145 virtual ~debDebPkgFileIndex();
146 };
147
148 class APT_HIDDEN debDscFileIndex : public pkgIndexFile
149 {
150 private:
151 void *d;
152 std::string DscFile;
153 public:
154 virtual const Type *GetType() const APT_CONST;
155 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
156 virtual bool Exists() const;
157 virtual bool HasPackages() const {return false;};
158 virtual unsigned long Size() const;
159 virtual std::string Describe(bool /*Short*/) const {
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