]>
Commit | Line | Data |
---|---|---|
578bfd0a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
b35d2f5f | 3 | // $Id: pkgcachegen.h,v 1.9 1998/07/26 04:49:32 jgg Exp $ |
578bfd0a AL |
4 | /* ###################################################################### |
5 | ||
6 | Package Cache Generator - Generator for the cache structure. | |
7 | ||
8 | This builds the cache structure from the abstract package list parser. | |
6fc33863 AL |
9 | Each archive source has it's own list parser that is instantiated by |
10 | the caller to provide data for the generator. | |
11 | ||
12 | Parts of the cache are created by this generator class while other | |
13 | parts are created by the list parser. The list parser is responsible | |
14 | for creating version, depends and provides structures, and some of | |
15 | their contents | |
578bfd0a AL |
16 | |
17 | ##################################################################### */ | |
18 | /*}}}*/ | |
19 | // Header section: pkglib | |
20 | #ifndef PKGLIB_PKGCACHEGEN_H | |
21 | #define PKGLIB_PKGCACHEGEN_H | |
22 | ||
6c139d6e | 23 | #ifdef __GNUG__ |
094a497d | 24 | #pragma interface "apt-pkg/pkgcachegen.h" |
6c139d6e AL |
25 | #endif |
26 | ||
094a497d | 27 | #include <apt-pkg/pkgcache.h> |
b35d2f5f AL |
28 | |
29 | class pkgSourceList; | |
30 | class OpProgress; | |
578bfd0a AL |
31 | |
32 | class pkgCacheGenerator | |
33 | { | |
34 | public: | |
35 | ||
36 | class ListParser; | |
37 | ||
38 | protected: | |
39 | ||
40 | DynamicMMap ⤅ | |
41 | pkgCache Cache; | |
404ec98e AL |
42 | OpProgress &Progress; |
43 | ||
578bfd0a AL |
44 | string PkgFileName; |
45 | pkgCache::PackageFile *CurrentFile; | |
46 | ||
f55a958f AL |
47 | bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg); |
48 | bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); | |
49 | unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next); | |
578bfd0a | 50 | |
f55a958f AL |
51 | unsigned long WriteUniqString(const char *S,unsigned int Size); |
52 | inline unsigned long WriteUniqString(string S) {return WriteUniqString(S);}; | |
53 | ||
578bfd0a AL |
54 | public: |
55 | ||
56 | // This is the abstract package list parser class. | |
57 | class ListParser | |
58 | { | |
59 | pkgCacheGenerator *Owner; | |
60 | friend pkgCacheGenerator; | |
61 | ||
62 | protected: | |
63 | ||
f55a958f AL |
64 | inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);}; |
65 | inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; | |
578bfd0a AL |
66 | inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);}; |
67 | inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);}; | |
dcb79bae AL |
68 | bool NewDepends(pkgCache::VerIterator Ver,string Package, |
69 | string Version,unsigned int Op, | |
70 | unsigned int Type); | |
71 | bool NewProvides(pkgCache::VerIterator Ver,string Package,string Version); | |
f55a958f | 72 | |
578bfd0a AL |
73 | public: |
74 | ||
75 | // These all operate against the current section | |
76 | virtual string Package() = 0; | |
77 | virtual string Version() = 0; | |
78 | virtual bool NewVersion(pkgCache::VerIterator Ver) = 0; | |
f55a958f AL |
79 | virtual bool UsePackage(pkgCache::PkgIterator Pkg, |
80 | pkgCache::VerIterator Ver) = 0; | |
dcb79bae AL |
81 | virtual unsigned long Offset() = 0; |
82 | virtual unsigned long Size() = 0; | |
ad00ae81 | 83 | |
578bfd0a | 84 | virtual bool Step() = 0; |
dcb79bae | 85 | |
f55a958f | 86 | virtual ~ListParser() {}; |
578bfd0a AL |
87 | }; |
88 | friend ListParser; | |
89 | ||
90 | bool SelectFile(string File,unsigned long Flags = 0); | |
91 | bool MergeList(ListParser &List); | |
ad00ae81 | 92 | inline pkgCache &GetCache() {return Cache;}; |
b35d2f5f | 93 | |
404ec98e | 94 | pkgCacheGenerator(DynamicMMap &Map,OpProgress &Progress); |
578bfd0a AL |
95 | ~pkgCacheGenerator(); |
96 | }; | |
97 | ||
b35d2f5f AL |
98 | bool pkgSrcCacheCheck(pkgSourceList &List); |
99 | bool pkgPkgCacheCheck(string CacheFile); | |
100 | bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress); | |
101 | ||
578bfd0a | 102 | #endif |