]>
git.saurik.com Git - apt.git/blob - apt-pkg/pkgcachegen.h
8ffb277c6e7feec8f690797dca26bdd571dcd7d6
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: pkgcachegen.h,v 1.12 1999/02/23 06:46:24 jgg Exp $
4 /* ######################################################################
6 Package Cache Generator - Generator for the cache structure.
8 This builds the cache structure from the abstract package list parser.
9 Each archive source has it's own list parser that is instantiated by
10 the caller to provide data for the generator.
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
17 ##################################################################### */
19 // Header section: pkglib
20 #ifndef PKGLIB_PKGCACHEGEN_H
21 #define PKGLIB_PKGCACHEGEN_H
24 #pragma interface "apt-pkg/pkgcachegen.h"
27 #include <apt-pkg/pkgcache.h>
32 class pkgCacheGenerator
36 pkgCache::StringItem
*UniqHash
[26];
50 pkgCache::PackageFile
*CurrentFile
;
52 bool NewPackage(pkgCache::PkgIterator
&Pkg
,string Pkg
);
53 bool NewFileVer(pkgCache::VerIterator
&Ver
,ListParser
&List
);
54 unsigned long NewVersion(pkgCache::VerIterator
&Ver
,string VerStr
,unsigned long Next
);
56 unsigned long WriteUniqString(const char *S
,unsigned int Size
);
57 inline unsigned long WriteUniqString(string S
) {return WriteUniqString(S
);};
61 bool SelectFile(string File
,unsigned long Flags
= 0);
62 bool MergeList(ListParser
&List
);
63 inline pkgCache
&GetCache() {return Cache
;};
64 inline pkgCache::PkgFileIterator
GetCurFile()
65 {return pkgCache::PkgFileIterator(Cache
,CurrentFile
);};
67 pkgCacheGenerator(DynamicMMap
&Map
,OpProgress
&Progress
);
71 bool pkgSrcCacheCheck(pkgSourceList
&List
);
72 bool pkgPkgCacheCheck(string CacheFile
);
73 bool pkgMakeStatusCache(pkgSourceList
&List
,OpProgress
&Progress
);
75 // This is the abstract package list parser class.
76 class pkgCacheGenerator::ListParser
78 pkgCacheGenerator
*Owner
;
79 friend pkgCacheGenerator
;
82 pkgCache::VerIterator OldDepVer
;
83 __apt_ptrloc
*OldDepLast
;
87 inline unsigned long WriteUniqString(string S
) {return Owner
->WriteUniqString(S
);};
88 inline unsigned long WriteUniqString(const char *S
,unsigned int Size
) {return Owner
->WriteUniqString(S
,Size
);};
89 inline unsigned long WriteString(string S
) {return Owner
->Map
.WriteString(S
);};
90 inline unsigned long WriteString(const char *S
,unsigned int Size
) {return Owner
->Map
.WriteString(S
,Size
);};
91 bool NewDepends(pkgCache::VerIterator Ver
,string Package
,
92 string Version
,unsigned int Op
,
94 bool NewProvides(pkgCache::VerIterator Ver
,string Package
,string Version
);
98 // These all operate against the current section
99 virtual string
Package() = 0;
100 virtual string
Version() = 0;
101 virtual bool NewVersion(pkgCache::VerIterator Ver
) = 0;
102 virtual bool UsePackage(pkgCache::PkgIterator Pkg
,
103 pkgCache::VerIterator Ver
) = 0;
104 virtual unsigned long Offset() = 0;
105 virtual unsigned long Size() = 0;
107 virtual bool Step() = 0;
109 virtual ~ListParser() {};