1 // -*- mode: cpp; mode: fold -*-
3 // $Id: debindexfile.h,v 1.3.2.1 2003/12/24 23:09:17 mdz Exp $
4 /* ######################################################################
8 There are three sorts currently
10 Package files that have File: tags
11 Package files that don't (/var/lib/dpkg/status)
14 ##################################################################### */
16 #ifndef PKGLIB_DEBINDEXFILE_H
17 #define PKGLIB_DEBINDEXFILE_H
19 #include <apt-pkg/indexfile.h>
20 #include <apt-pkg/cacheiterators.h>
21 #include <apt-pkg/pkgcache.h>
22 #include <apt-pkg/srcrecords.h>
28 class pkgCacheGenerator
;
31 class APT_HIDDEN debStatusIndex
: public pkgIndexFile
33 /** \brief dpointer placeholder (for later in case we need it) */
41 virtual const Type
*GetType() const APT_CONST
;
43 // Interface for acquire
44 virtual std::string
Describe(bool /*Short*/) const {return File
;};
46 // Interface for the Cache Generator
47 virtual bool Exists() const;
48 virtual bool HasPackages() const {return true;};
49 virtual unsigned long Size() const;
50 virtual bool Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const;
51 bool Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
, unsigned long const Flag
) const;
52 virtual pkgCache::PkgFileIterator
FindInCache(pkgCache
&Cache
) const;
54 debStatusIndex(std::string File
);
55 virtual ~debStatusIndex();
58 class APT_HIDDEN debPackagesIndex
: public pkgIndexFile
60 /** \brief dpointer placeholder (for later in case we need it) */
66 std::string Architecture
;
68 APT_HIDDEN
std::string
Info(const char *Type
) const;
69 APT_HIDDEN
std::string
IndexFile(const char *Type
) const;
70 APT_HIDDEN
std::string
IndexURI(const char *Type
) const;
74 virtual const Type
*GetType() const APT_CONST
;
76 // Stuff for accessing files on remote items
77 virtual std::string
ArchiveInfo(pkgCache::VerIterator Ver
) const;
78 virtual std::string
ArchiveURI(std::string File
) const {return URI
+ File
;};
80 // Interface for acquire
81 virtual std::string
Describe(bool Short
) const;
83 // Interface for the Cache Generator
84 virtual bool Exists() const;
85 virtual bool HasPackages() const {return true;};
86 virtual unsigned long Size() const;
87 virtual bool Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const;
88 virtual pkgCache::PkgFileIterator
FindInCache(pkgCache
&Cache
) const;
90 debPackagesIndex(std::string
const &URI
, std::string
const &Dist
, std::string
const &Section
,
91 bool const &Trusted
, std::string
const &Arch
= "native");
92 virtual ~debPackagesIndex();
95 class APT_HIDDEN debTranslationsIndex
: public pkgIndexFile
97 /** \brief dpointer placeholder (for later in case we need it) */
103 const char * const Language
;
105 APT_HIDDEN
std::string
Info(const char *Type
) const;
106 APT_HIDDEN
std::string
IndexFile(const char *Type
) const;
107 APT_HIDDEN
std::string
IndexURI(const char *Type
) const;
109 APT_HIDDEN
std::string
TranslationFile() const {return std::string("Translation-").append(Language
);};
113 virtual const Type
*GetType() const APT_CONST
;
115 // Interface for acquire
116 virtual std::string
Describe(bool Short
) const;
118 // Interface for the Cache Generator
119 virtual bool Exists() const;
120 virtual bool HasPackages() const;
121 virtual unsigned long Size() const;
122 virtual bool Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const;
123 virtual pkgCache::PkgFileIterator
FindInCache(pkgCache
&Cache
) const;
125 debTranslationsIndex(std::string URI
,std::string Dist
,std::string Section
, char const * const Language
);
126 virtual ~debTranslationsIndex();
129 class APT_HIDDEN debSourcesIndex
: public pkgIndexFile
131 /** \brief dpointer placeholder (for later in case we need it) */
138 APT_HIDDEN
std::string
Info(const char *Type
) const;
139 APT_HIDDEN
std::string
IndexFile(const char *Type
) const;
140 APT_HIDDEN
std::string
IndexURI(const char *Type
) const;
144 virtual const Type
*GetType() const APT_CONST
;
146 // Stuff for accessing files on remote items
147 virtual std::string
SourceInfo(pkgSrcRecords::Parser
const &Record
,
148 pkgSrcRecords::File
const &File
) const;
149 virtual std::string
ArchiveURI(std::string File
) const {return URI
+ File
;};
151 // Interface for acquire
152 virtual std::string
Describe(bool Short
) const;
154 // Interface for the record parsers
155 virtual pkgSrcRecords::Parser
*CreateSrcParser() const;
157 // Interface for the Cache Generator
158 virtual bool Exists() const;
159 virtual bool HasPackages() const {return false;};
160 virtual unsigned long Size() const;
162 debSourcesIndex(std::string URI
,std::string Dist
,std::string Section
,bool Trusted
);
163 virtual ~debSourcesIndex();
166 class APT_HIDDEN debDebPkgFileIndex
: public pkgIndexFile
171 std::string DebFileFullPath
;
174 virtual const Type
*GetType() const APT_CONST
;
176 virtual std::string
Describe(bool /*Short*/) const {
180 /** get the control (file) content of the deb file
182 * @param[out] content of the control file
183 * @param debfile is the filename of the .deb-file
184 * @return \b true if successful, otherwise \b false.
186 static bool GetContent(std::ostream
&content
, std::string
const &debfile
);
188 // Interface for the Cache Generator
189 virtual bool Exists() const;
190 virtual bool HasPackages() const {
193 virtual unsigned long Size() const;
194 virtual bool Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const;
195 virtual pkgCache::PkgFileIterator
FindInCache(pkgCache
&Cache
) const;
197 // Interface for acquire
198 virtual std::string
ArchiveURI(std::string
/*File*/) const;
200 debDebPkgFileIndex(std::string DebFile
);
201 virtual ~debDebPkgFileIndex();
204 class APT_HIDDEN debDscFileIndex
: public pkgIndexFile
209 virtual const Type
*GetType() const APT_CONST
;
210 virtual pkgSrcRecords::Parser
*CreateSrcParser() const;
211 virtual bool Exists() const;
212 virtual bool HasPackages() const {return false;};
213 virtual unsigned long Size() const;
214 virtual std::string
Describe(bool /*Short*/) const {
218 debDscFileIndex(std::string
&DscFile
);
219 virtual ~debDscFileIndex() {};
222 class APT_HIDDEN debDebianSourceDirIndex
: public debDscFileIndex
225 virtual const Type
*GetType() const APT_CONST
;