]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/deblistparser.h
Open 0.5.31
[apt.git] / apt-pkg / deb / deblistparser.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: deblistparser.h,v 1.9 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
5
6 Debian Package List Parser - This implements the abstract parser
7 interface for Debian package files
8
9 ##################################################################### */
10 /*}}}*/
11 #ifndef PKGLIB_DEBLISTPARSER_H
12 #define PKGLIB_DEBLISTPARSER_H
13
14 #include <apt-pkg/pkgcachegen.h>
15 #include <apt-pkg/tagfile.h>
16
17 class debListParser : public pkgCacheGenerator::ListParser
18 {
19 public:
20
21 // Parser Helper
22 struct WordList
23 {
24 const char *Str;
25 unsigned char Val;
26 };
27
28 private:
29
30 pkgTagFile Tags;
31 pkgTagSection Section;
32 unsigned long iOffset;
33 string Arch;
34
35 unsigned long UniqFindTagWrite(const char *Tag);
36 bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
37 bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag,
38 unsigned int Type);
39 bool ParseProvides(pkgCache::VerIterator Ver);
40 static bool GrabWord(string Word,WordList *List,unsigned char &Out);
41
42 public:
43
44 static unsigned char GetPrio(string Str);
45
46 // These all operate against the current section
47 virtual string Package();
48 virtual string Version();
49 virtual bool NewVersion(pkgCache::VerIterator Ver);
50 virtual unsigned short VersionHash();
51 virtual bool UsePackage(pkgCache::PkgIterator Pkg,
52 pkgCache::VerIterator Ver);
53 virtual unsigned long Offset() {return iOffset;};
54 virtual unsigned long Size() {return Section.size();};
55
56 virtual bool Step();
57
58 bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File);
59
60 static const char *ParseDepends(const char *Start,const char *Stop,
61 string &Package,string &Ver,unsigned int &Op,
62 bool ParseArchFlags = false);
63 static const char *ConvertRelation(const char *I,unsigned int &Op);
64
65 debListParser(FileFd *File);
66 };
67
68 #endif