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