]> git.saurik.com Git - apt-legacy.git/blob - apt-pkg/deb/deblistparser.h
a7b7373b6b5a0f0fcba2645e405c0c218a8de67d
[apt-legacy.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/indexfile.h>
16 #include <apt-pkg/tagfile.h>
17
18 class debListParser : public pkgCacheGenerator::ListParser
19 {
20 public:
21
22 // Parser Helper
23 struct WordList
24 {
25 const char *Str;
26 unsigned char Val;
27 };
28
29 private:
30
31 pkgTagFile Tags;
32 pkgTagSection Section;
33 unsigned long iOffset;
34 string Arch;
35
36 unsigned long UniqFindTagWrite(const char *Tag);
37 bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
38 bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag,
39 unsigned int Type);
40 bool ParseProvides(pkgCache::VerIterator Ver);
41 bool ParseTag(pkgCache::PkgIterator Pkg);
42 static bool GrabWord(string Word,WordList *List,unsigned char &Out);
43
44 public:
45
46 static unsigned char GetPrio(string Str);
47
48 // These all operate against the current section
49 virtual string Package();
50 virtual string Version();
51 virtual bool NewVersion(pkgCache::VerIterator Ver);
52 virtual string Description();
53 virtual string DescriptionLanguage();
54 virtual MD5SumValue Description_md5();
55 virtual unsigned short VersionHash();
56 virtual bool UsePackage(pkgCache::PkgIterator Pkg,
57 pkgCache::VerIterator Ver);
58 virtual unsigned long Offset() {return iOffset;};
59 virtual unsigned long Size() {return Section.size();};
60
61 virtual bool Step();
62
63 bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File,
64 string section);
65
66 static const char *ParseDepends(const char *Start,const char *Stop,
67 string &Package,string &Ver,unsigned int &Op,
68 bool ParseArchFlags = false);
69 static const char *ConvertRelation(const char *I,unsigned int &Op);
70
71 debListParser(FileFd *File);
72 };
73
74 #endif