]>
git.saurik.com Git - apt.git/blob - apt-pkg/pkgcachegen.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: pkgcachegen.h,v 1.5 1998/07/12 23:58:35 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
17 #pragma interface "apt-pkg/pkgcachegen.h"
20 #include <apt-pkg/pkgcache.h>
22 class pkgCacheGenerator
34 pkgCache::PackageFile
*CurrentFile
;
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
);
40 unsigned long WriteUniqString(const char *S
,unsigned int Size
);
41 inline unsigned long WriteUniqString(string S
) {return WriteUniqString(S
);};
45 // This is the abstract package list parser class.
48 pkgCacheGenerator
*Owner
;
49 friend pkgCacheGenerator
;
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
);};
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
);};
57 bool NewDepends(pkgCache::VerIterator Ver
,string Package
,
58 string Version
,unsigned int Op
,
60 bool NewProvides(pkgCache::VerIterator Ver
,string Package
,string Version
);
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;
68 virtual bool UsePackage(pkgCache::PkgIterator Pkg
,
69 pkgCache::VerIterator Ver
) = 0;
70 virtual unsigned long Offset() = 0;
71 virtual unsigned long Size() = 0;
73 virtual bool Step() = 0;
75 virtual ~ListParser() {};
79 bool SelectFile(string File
,unsigned long Flags
= 0);
80 bool MergeList(ListParser
&List
);
82 pkgCacheGenerator(DynamicMMap
&Map
);