]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/debindexfile.h
support regular expressions in 'apt search'
[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 #include <apt-pkg/indexfile.h>
20 #include <apt-pkg/cacheiterators.h>
21 #include <apt-pkg/pkgcache.h>
22 #include <apt-pkg/srcrecords.h>
23
24 #include <string>
25
26 class OpProgress;
27 class pkgAcquire;
28 class pkgCacheGenerator;
29
30
31 class debStatusIndex : public pkgIndexFile
32 {
33 /** \brief dpointer placeholder (for later in case we need it) */
34 void *d;
35
36 protected:
37 std::string File;
38
39 public:
40
41 virtual const Type *GetType() const APT_CONST;
42
43 // Interface for acquire
44 virtual std::string Describe(bool /*Short*/) const {return File;};
45
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;
53
54 debStatusIndex(std::string File);
55 virtual ~debStatusIndex() {};
56 };
57
58 class debPackagesIndex : public pkgIndexFile
59 {
60 /** \brief dpointer placeholder (for later in case we need it) */
61 void *d;
62
63 std::string URI;
64 std::string Dist;
65 std::string Section;
66 std::string Architecture;
67
68 std::string Info(const char *Type) const;
69 std::string IndexFile(const char *Type) const;
70 std::string IndexURI(const char *Type) const;
71
72 public:
73
74 virtual const Type *GetType() const APT_CONST;
75
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;};
79
80 // Interface for acquire
81 virtual std::string Describe(bool Short) const;
82
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;
89
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() {};
93 };
94
95 class debTranslationsIndex : public pkgIndexFile
96 {
97 /** \brief dpointer placeholder (for later in case we need it) */
98 void *d;
99
100 std::string URI;
101 std::string Dist;
102 std::string Section;
103 const char * const Language;
104
105 std::string Info(const char *Type) const;
106 std::string IndexFile(const char *Type) const;
107 std::string IndexURI(const char *Type) const;
108
109 inline std::string TranslationFile() const {return std::string("Translation-").append(Language);};
110
111 public:
112
113 virtual const Type *GetType() const APT_CONST;
114
115 // Interface for acquire
116 virtual std::string Describe(bool Short) const;
117 virtual bool GetIndexes(pkgAcquire *Owner) const;
118
119 // Interface for the Cache Generator
120 virtual bool Exists() const;
121 virtual bool HasPackages() const;
122 virtual unsigned long Size() const;
123 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
124 virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
125
126 debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language);
127 virtual ~debTranslationsIndex() {};
128 };
129
130 class debSourcesIndex : public pkgIndexFile
131 {
132 /** \brief dpointer placeholder (for later in case we need it) */
133 void *d;
134
135 std::string URI;
136 std::string Dist;
137 std::string Section;
138
139 std::string Info(const char *Type) const;
140 std::string IndexFile(const char *Type) const;
141 std::string IndexURI(const char *Type) const;
142
143 public:
144
145 virtual const Type *GetType() const APT_CONST;
146
147 // Stuff for accessing files on remote items
148 virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
149 pkgSrcRecords::File const &File) const;
150 virtual std::string ArchiveURI(std::string File) const {return URI + File;};
151
152 // Interface for acquire
153 virtual std::string Describe(bool Short) const;
154
155 // Interface for the record parsers
156 virtual pkgSrcRecords::Parser *CreateSrcParser() const;
157
158 // Interface for the Cache Generator
159 virtual bool Exists() const;
160 virtual bool HasPackages() const {return false;};
161 virtual unsigned long Size() const;
162
163 debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted);
164 virtual ~debSourcesIndex() {};
165 };
166
167 #endif