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