]>
git.saurik.com Git - apt.git/blob - apt-pkg/pkgcachegen.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: pkgcachegen.h,v 1.2 1998/07/04 05:57:38 jgg Exp $
4 /* ######################################################################
6 Package Cache Generator - Generator for the cache structure.
8 This builds the cache structure from the abstract package list parser.
10 ##################################################################### */
12 // Header section: pkglib
13 #ifndef PKGLIB_PKGCACHEGEN_H
14 #define PKGLIB_PKGCACHEGEN_H
16 #include <pkglib/pkgcache.h>
18 class pkgCacheGenerator
30 pkgCache::PackageFile
*CurrentFile
;
32 bool NewPackage(pkgCache::PkgIterator
&Pkg
,string Pkg
);
33 bool NewFileVer(pkgCache::VerIterator
&Ver
,ListParser
&List
);
34 unsigned long NewVersion(pkgCache::VerIterator
&Ver
,string VerStr
,unsigned long Next
);
36 unsigned long WriteUniqString(const char *S
,unsigned int Size
);
37 inline unsigned long WriteUniqString(string S
) {return WriteUniqString(S
);};
41 // This is the abstract package list parser class.
44 pkgCacheGenerator
*Owner
;
45 friend pkgCacheGenerator
;
49 inline unsigned long WriteUniqString(string S
) {return Owner
->WriteUniqString(S
);};
50 inline unsigned long WriteUniqString(const char *S
,unsigned int Size
) {return Owner
->WriteUniqString(S
,Size
);};
51 inline unsigned long WriteString(string S
) {return Owner
->Map
.WriteString(S
);};
52 inline unsigned long WriteString(const char *S
,unsigned int Size
) {return Owner
->Map
.WriteString(S
,Size
);};
56 // These all operate against the current section
57 virtual string
Package() = 0;
58 virtual string
Version() = 0;
59 virtual bool NewVersion(pkgCache::VerIterator Ver
) = 0;
60 virtual bool NewPackage(pkgCache::PkgIterator Pkg
) = 0;
61 virtual bool UsePackage(pkgCache::PkgIterator Pkg
,
62 pkgCache::VerIterator Ver
) = 0;
64 virtual bool Step() = 0;
65 virtual ~ListParser() {};
69 bool SelectFile(string File
,unsigned long Flags
= 0);
70 bool MergeList(ListParser
&List
);
72 pkgCacheGenerator(DynamicMMap
&Map
);