]>
git.saurik.com Git - apt.git/blob - apt-pkg/pkgcachegen.h
395afdc83e2692428a496a439b1bd2e235eb38ce
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: pkgcachegen.h,v 1.3 1998/07/05 05:33:57 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
);};
53 bool NewDepends(pkgCache::VerIterator Ver
,string Package
,
54 string Version
,unsigned int Op
,
56 bool NewProvides(pkgCache::VerIterator Ver
,string Package
,string Version
);
60 // These all operate against the current section
61 virtual string
Package() = 0;
62 virtual string
Version() = 0;
63 virtual bool NewVersion(pkgCache::VerIterator Ver
) = 0;
64 virtual bool UsePackage(pkgCache::PkgIterator Pkg
,
65 pkgCache::VerIterator Ver
) = 0;
66 virtual unsigned long Offset() = 0;
67 virtual unsigned long Size() = 0;
69 virtual bool Step() = 0;
71 virtual ~ListParser() {};
75 bool SelectFile(string File
,unsigned long Flags
= 0);
76 bool MergeList(ListParser
&List
);
78 pkgCacheGenerator(DynamicMMap
&Map
);