summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.h
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:50:36 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:50:36 +0000
commit578bfd0aed2ec993f4ad85fa6a7094a852261422 (patch)
tree737f52267f6468a4b6754f8c6665824767352746 /apt-pkg/pkgcachegen.h
Base revisions
Author: jgg Date: 1998-07-02 02:58:12 GMT Base revisions
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r--apt-pkg/pkgcachegen.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
new file mode 100644
index 000000000..1385ab964
--- /dev/null
+++ b/apt-pkg/pkgcachegen.h
@@ -0,0 +1,69 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: pkgcachegen.h,v 1.1 1998/07/02 02:58:13 jgg Exp $
+/* ######################################################################
+
+ Package Cache Generator - Generator for the cache structure.
+
+ This builds the cache structure from the abstract package list parser.
+
+ ##################################################################### */
+ /*}}}*/
+// Header section: pkglib
+#ifndef PKGLIB_PKGCACHEGEN_H
+#define PKGLIB_PKGCACHEGEN_H
+
+#include <pkglib/pkgcache.h>
+
+class pkgCacheGenerator
+{
+ public:
+
+ class ListParser;
+
+ protected:
+
+ DynamicMMap &Map;
+ pkgCache Cache;
+
+ string PkgFileName;
+ pkgCache::PackageFile *CurrentFile;
+
+ bool NewPackage(pkgCache::PkgIterator Pkg,string Pkg);
+ bool NewFileVer(pkgCache::VerIterator Ver,ListParser &List);
+ unsigned long NewVersion(pkgCache::VerIterator &Ver,unsigned long Next);
+
+ public:
+
+ // This is the abstract package list parser class.
+ class ListParser
+ {
+ pkgCacheGenerator *Owner;
+ friend pkgCacheGenerator;
+
+ protected:
+
+ inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
+ inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
+
+ public:
+
+ // These all operate against the current section
+ virtual string Package() = 0;
+ virtual string Version() = 0;
+ virtual bool NewVersion(pkgCache::VerIterator Ver) = 0;
+ virtual bool NewPackage(pkgCache::PkgIterator Pkg) = 0;
+ virtual bool UsePackage(pkgCache::PkgIterator Pkg) = 0;
+
+ virtual bool Step() = 0;
+ };
+ friend ListParser;
+
+ bool SelectFile(string File,unsigned long Flags = 0);
+ bool MergeList(ListParser &List);
+
+ pkgCacheGenerator(DynamicMMap &Map);
+ ~pkgCacheGenerator();
+};
+
+#endif