]> git.saurik.com Git - apt.git/blame - apt-pkg/pkgcachegen.h
Fixed doc reference
[apt.git] / apt-pkg / pkgcachegen.h
CommitLineData
578bfd0a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
f55ece0e 3// $Id: pkgcachegen.h,v 1.10 1998/08/09 00:51:34 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.
6fc33863
AL
9 Each archive source has it's own list parser that is instantiated by
10 the caller to provide data for the generator.
11
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
15 their contents
578bfd0a
AL
16
17 ##################################################################### */
18 /*}}}*/
19// Header section: pkglib
20#ifndef PKGLIB_PKGCACHEGEN_H
21#define PKGLIB_PKGCACHEGEN_H
22
6c139d6e 23#ifdef __GNUG__
094a497d 24#pragma interface "apt-pkg/pkgcachegen.h"
6c139d6e
AL
25#endif
26
094a497d 27#include <apt-pkg/pkgcache.h>
b35d2f5f
AL
28
29class pkgSourceList;
30class OpProgress;
578bfd0a
AL
31
32class pkgCacheGenerator
33{
34 public:
35
36 class ListParser;
f55ece0e 37 friend ListParser;
578bfd0a
AL
38
39 protected:
40
41 DynamicMMap &Map;
42 pkgCache Cache;
404ec98e
AL
43 OpProgress &Progress;
44
578bfd0a
AL
45 string PkgFileName;
46 pkgCache::PackageFile *CurrentFile;
47
f55a958f
AL
48 bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
49 bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
50 unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next);
578bfd0a 51
f55a958f
AL
52 unsigned long WriteUniqString(const char *S,unsigned int Size);
53 inline unsigned long WriteUniqString(string S) {return WriteUniqString(S);};
54
f55ece0e 55 public:
578bfd0a
AL
56
57 bool SelectFile(string File,unsigned long Flags = 0);
58 bool MergeList(ListParser &List);
ad00ae81 59 inline pkgCache &GetCache() {return Cache;};
b35d2f5f 60
404ec98e 61 pkgCacheGenerator(DynamicMMap &Map,OpProgress &Progress);
578bfd0a
AL
62 ~pkgCacheGenerator();
63};
64
b35d2f5f
AL
65bool pkgSrcCacheCheck(pkgSourceList &List);
66bool pkgPkgCacheCheck(string CacheFile);
67bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress);
68
f55ece0e
AL
69// This is the abstract package list parser class.
70class pkgCacheGenerator::ListParser
71{
72 pkgCacheGenerator *Owner;
73 friend pkgCacheGenerator;
74
75 protected:
76
77 inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
78 inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
79 inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
80 inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
81 bool NewDepends(pkgCache::VerIterator Ver,string Package,
82 string Version,unsigned int Op,
83 unsigned int Type);
84 bool NewProvides(pkgCache::VerIterator Ver,string Package,string Version);
85
86 public:
87
88 // These all operate against the current section
89 virtual string Package() = 0;
90 virtual string Version() = 0;
91 virtual bool NewVersion(pkgCache::VerIterator Ver) = 0;
92 virtual bool UsePackage(pkgCache::PkgIterator Pkg,
93 pkgCache::VerIterator Ver) = 0;
94 virtual unsigned long Offset() = 0;
95 virtual unsigned long Size() = 0;
96
97 virtual bool Step() = 0;
98
99 virtual ~ListParser() {};
100};
101
578bfd0a 102#endif