]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
implement 'apt-get files' to access index targets
[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 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 bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
49 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
50
51 debStatusIndex(std::string File);
52 virtual ~debStatusIndex();
53 };
54
55 class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
56 {
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 public:
76
77 virtual const Type *GetType() const APT_CONST;
78
79 // Interface for the Cache Generator
80 virtual bool HasPackages() const;
81 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
82 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
83
84 debTranslationsIndex(IndexTarget const &Target);
85 virtual ~debTranslationsIndex();
86 };
87
88 class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
89 {
90 public:
91
92 virtual const Type *GetType() const APT_CONST;
93
94 // Stuff for accessing files on remote items
95 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
96 pkgSrcRecords::File const &File) const;
97
98 // Interface for the record parsers
99 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
100
101 // Interface for the Cache Generator
102 virtual bool HasPackages() const {return false;};
103
104 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
105 virtual ~debSourcesIndex();
106 };
107
108 class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
109 {
110 private:
111 void *d;
112 std::string DebFile;
113 std::string DebFileFullPath;
114
115 public:
116 virtual const Type *GetType() const APT_CONST;
117
118 virtual std::string Describe(bool /*Short*/) const {
119 return DebFile;
120 }
121
122 /** get the control (file) content of the deb file
123 *
124 * @param[out] content of the control file
125 * @param debfile is the filename of the .deb-file
126 * @return \b true if successful, otherwise \b false.
127 */
128 static bool GetContent(std::ostream &content, std::string const &debfile);
129
130 // Interface for the Cache Generator
131 virtual bool Exists() const;
132 virtual bool HasPackages() const {
133 return true;
134 };
135 virtual unsigned long Size() const;
136 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
137 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
138
139 // Interface for acquire
140 virtual std::string ArchiveURI(std::string /*File*/) const;
141
142 debDebPkgFileIndex(std::string DebFile);
143 virtual ~debDebPkgFileIndex();
144 };
145
146 class APT_HIDDEN debDscFileIndex : public pkgIndexFile
147 {
148 private:
149 std::string DscFile;
150 public:
151 virtual const Type *GetType() const APT_CONST;
152 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
153 virtual bool Exists() const;
154 virtual bool HasPackages() const {return false;};
155 virtual unsigned long Size() const;
156 virtual std::string Describe(bool /*Short*/) const {
157 return DscFile;
158 };
159
160 debDscFileIndex(std::string &DscFile);
161 virtual ~debDscFileIndex() {};
162 };
163
164 class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex
165 {
166 public:
167 virtual const Type *GetType() const APT_CONST;
168 };
169
170 #endif