]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/debindexfile.h
use an enum instead of strings as IndexTarget::Option interface
[apt.git] / apt-pkg / deb / debindexfile.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
7db98ffc 3// $Id: debindexfile.h,v 1.3.2.1 2003/12/24 23:09:17 mdz Exp $
b2e465d6
AL
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
453b82a3
DK
19#include <apt-pkg/indexfile.h>
20#include <apt-pkg/cacheiterators.h>
21#include <apt-pkg/pkgcache.h>
22#include <apt-pkg/srcrecords.h>
13500573 23
453b82a3
DK
24#include <string>
25
26class OpProgress;
27class pkgAcquire;
28class pkgCacheGenerator;
b2e465d6 29
b2e465d6 30
dce45dbe 31class APT_HIDDEN debStatusIndex : public pkgIndexFile
b2e465d6 32{
6d38011b 33 protected:
8f3ba4e8 34 std::string File;
6d38011b 35
b2e465d6
AL
36 public:
37
a02db58f 38 virtual const Type *GetType() const APT_CONST;
e3c1cfc7 39
b2e465d6 40 // Interface for acquire
65512241 41 virtual std::string Describe(bool /*Short*/) const {return File;};
e3c1cfc7 42
b2e465d6
AL
43 // Interface for the Cache Generator
44 virtual bool Exists() const;
45 virtual bool HasPackages() const {return true;};
46 virtual unsigned long Size() const;
2e5f4e45 47 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
6d38011b 48 bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
b2e465d6
AL
49 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
50
8f3ba4e8 51 debStatusIndex(std::string File);
862bafea 52 virtual ~debStatusIndex();
b2e465d6 53};
3809194b 54
e3c1cfc7
DK
55class APT_HIDDEN debPackagesIndex : public pkgIndexTargetFile
56{
b2e465d6 57 public:
e3c1cfc7 58
a02db58f 59 virtual const Type *GetType() const APT_CONST;
b2e465d6
AL
60
61 // Stuff for accessing files on remote items
8f3ba4e8 62 virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
e3c1cfc7 63
b2e465d6 64 // Interface for the Cache Generator
b2e465d6 65 virtual bool HasPackages() const {return true;};
2e5f4e45 66 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
b2e465d6 67 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
7db98ffc 68
e3c1cfc7 69 debPackagesIndex(IndexTarget const &Target, bool const Trusted);
862bafea 70 virtual ~debPackagesIndex();
b2e465d6
AL
71};
72
e3c1cfc7 73class APT_HIDDEN debTranslationsIndex : public pkgIndexTargetFile
a52f938b 74{
a52f938b 75 public:
d38926ef 76
a02db58f 77 virtual const Type *GetType() const APT_CONST;
a52f938b 78
a52f938b 79 // Interface for the Cache Generator
11680bfd 80 virtual bool HasPackages() const;
2e5f4e45 81 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
c51c6f08 82 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
a52f938b 83
e3c1cfc7 84 debTranslationsIndex(IndexTarget const &Target);
862bafea 85 virtual ~debTranslationsIndex();
a52f938b
OS
86};
87
e3c1cfc7 88class APT_HIDDEN debSourcesIndex : public pkgIndexTargetFile
b2e465d6 89{
b2e465d6
AL
90 public:
91
a02db58f 92 virtual const Type *GetType() const APT_CONST;
b2e465d6
AL
93
94 // Stuff for accessing files on remote items
8f3ba4e8 95 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
b2e465d6 96 pkgSrcRecords::File const &File) const;
b2e465d6
AL
97
98 // Interface for the record parsers
99 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
e3c1cfc7 100
b2e465d6 101 // Interface for the Cache Generator
b2e465d6 102 virtual bool HasPackages() const {return false;};
e3c1cfc7
DK
103
104 debSourcesIndex(IndexTarget const &Target, bool const Trusted);
862bafea 105 virtual ~debSourcesIndex();
b2e465d6
AL
106};
107
dce45dbe 108class APT_HIDDEN debDebPkgFileIndex : public pkgIndexFile
0d29b9d4
MV
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
2f6a2fbb
DK
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
0d29b9d4
MV
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);
862bafea
DK
143 virtual ~debDebPkgFileIndex();
144};
070536e6 145
dce45dbe 146class APT_HIDDEN debDscFileIndex : public pkgIndexFile
a49e7948
MV
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
dce45dbe 164class APT_HIDDEN debDebianSourceDirIndex : public debDscFileIndex
77da39b9 165{
3809194b 166 public:
77da39b9 167 virtual const Type *GetType() const APT_CONST;
0d29b9d4
MV
168};
169
b2e465d6 170#endif