]>
Commit | Line | Data |
---|---|---|
578bfd0a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
ad00ae81 | 3 | // $Id: pkgcachegen.h,v 1.6 1998/07/19 04:22:03 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. | |
9 | ||
10 | ##################################################################### */ | |
11 | /*}}}*/ | |
12 | // Header section: pkglib | |
13 | #ifndef PKGLIB_PKGCACHEGEN_H | |
14 | #define PKGLIB_PKGCACHEGEN_H | |
15 | ||
6c139d6e | 16 | #ifdef __GNUG__ |
094a497d | 17 | #pragma interface "apt-pkg/pkgcachegen.h" |
6c139d6e AL |
18 | #endif |
19 | ||
094a497d | 20 | #include <apt-pkg/pkgcache.h> |
578bfd0a AL |
21 | |
22 | class pkgCacheGenerator | |
23 | { | |
24 | public: | |
25 | ||
26 | class ListParser; | |
27 | ||
28 | protected: | |
29 | ||
30 | DynamicMMap ⤅ | |
31 | pkgCache Cache; | |
32 | ||
33 | string PkgFileName; | |
34 | pkgCache::PackageFile *CurrentFile; | |
35 | ||
f55a958f AL |
36 | bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg); |
37 | bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); | |
38 | unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next); | |
578bfd0a | 39 | |
f55a958f AL |
40 | unsigned long WriteUniqString(const char *S,unsigned int Size); |
41 | inline unsigned long WriteUniqString(string S) {return WriteUniqString(S);}; | |
42 | ||
578bfd0a AL |
43 | public: |
44 | ||
45 | // This is the abstract package list parser class. | |
46 | class ListParser | |
47 | { | |
48 | pkgCacheGenerator *Owner; | |
49 | friend pkgCacheGenerator; | |
50 | ||
51 | protected: | |
52 | ||
f55a958f AL |
53 | inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);}; |
54 | inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);}; | |
578bfd0a AL |
55 | inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);}; |
56 | inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);}; | |
dcb79bae AL |
57 | bool NewDepends(pkgCache::VerIterator Ver,string Package, |
58 | string Version,unsigned int Op, | |
59 | unsigned int Type); | |
60 | bool NewProvides(pkgCache::VerIterator Ver,string Package,string Version); | |
f55a958f | 61 | |
578bfd0a AL |
62 | public: |
63 | ||
64 | // These all operate against the current section | |
65 | virtual string Package() = 0; | |
66 | virtual string Version() = 0; | |
67 | virtual bool NewVersion(pkgCache::VerIterator Ver) = 0; | |
f55a958f AL |
68 | virtual bool UsePackage(pkgCache::PkgIterator Pkg, |
69 | pkgCache::VerIterator Ver) = 0; | |
dcb79bae AL |
70 | virtual unsigned long Offset() = 0; |
71 | virtual unsigned long Size() = 0; | |
ad00ae81 | 72 | |
578bfd0a | 73 | virtual bool Step() = 0; |
dcb79bae | 74 | |
f55a958f | 75 | virtual ~ListParser() {}; |
578bfd0a AL |
76 | }; |
77 | friend ListParser; | |
78 | ||
79 | bool SelectFile(string File,unsigned long Flags = 0); | |
80 | bool MergeList(ListParser &List); | |
ad00ae81 AL |
81 | inline pkgCache &GetCache() {return Cache;}; |
82 | ||
578bfd0a AL |
83 | pkgCacheGenerator(DynamicMMap &Map); |
84 | ~pkgCacheGenerator(); | |
85 | }; | |
86 | ||
87 | #endif |