merged from lp:~donkult/apt/sid
[ntk/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
20
21 #include <apt-pkg/indexfile.h>
22
23 class debStatusIndex : public pkgIndexFile
24 {
25 string File;
26
27 public:
28
29 virtual const Type *GetType() const;
30
31 // Interface for acquire
32 virtual string Describe(bool Short) const {return File;};
33
34 // Interface for the Cache Generator
35 virtual bool Exists() const;
36 virtual bool HasPackages() const {return true;};
37 virtual unsigned long Size() const;
38 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
39 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
40
41 debStatusIndex(string File);
42 };
43
44 class debPackagesIndex : public pkgIndexFile
45 {
46 string URI;
47 string Dist;
48 string Section;
49 string Architecture;
50
51 string Info(const char *Type) const;
52 string IndexFile(const char *Type) const;
53 string IndexURI(const char *Type) const;
54
55 public:
56
57 virtual const Type *GetType() const;
58
59 // Stuff for accessing files on remote items
60 virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
61 virtual string ArchiveURI(string File) const {return URI + File;};
62
63 // Interface for acquire
64 virtual string Describe(bool Short) const;
65
66 // Interface for the Cache Generator
67 virtual bool Exists() const;
68 virtual bool HasPackages() const {return true;};
69 virtual unsigned long Size() const;
70 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
71 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
72
73 debPackagesIndex(string const &URI, string const &Dist, string const &Section,
74 bool const &Trusted, string const &Arch = "native");
75 };
76
77 class debTranslationsIndex : public pkgIndexFile
78 {
79 string URI;
80 string Dist;
81 string Section;
82 const char * const Language;
83
84 string Info(const char *Type) const;
85 string IndexFile(const char *Type) const;
86 string IndexURI(const char *Type) const;
87
88 inline string TranslationFile() const {return string("Translation-").append(Language);};
89
90 public:
91
92 virtual const Type *GetType() const;
93
94 // Interface for acquire
95 virtual string Describe(bool Short) const;
96 virtual bool GetIndexes(pkgAcquire *Owner) const;
97
98 // Interface for the Cache Generator
99 virtual bool Exists() const;
100 virtual bool HasPackages() const;
101 virtual unsigned long Size() const;
102 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const;
103 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
104
105 debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
106 };
107
108 class debSourcesIndex : public pkgIndexFile
109 {
110 string URI;
111 string Dist;
112 string Section;
113
114 string Info(const char *Type) const;
115 string IndexFile(const char *Type) const;
116 string IndexURI(const char *Type) const;
117
118 public:
119
120 virtual const Type *GetType() const;
121
122 // Stuff for accessing files on remote items
123 virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
124 pkgSrcRecords::File const &File) const;
125 virtual string ArchiveURI(string File) const {return URI + File;};
126
127 // Interface for acquire
128 virtual string Describe(bool Short) const;
129
130 // Interface for the record parsers
131 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
132
133 // Interface for the Cache Generator
134 virtual bool Exists() const;
135 virtual bool HasPackages() const {return false;};
136 virtual unsigned long Size() const;
137
138 debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
139 };
140
141 #endif