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