]> git.saurik.com Git - apt.git/blob - apt-pkg/deb/deblistparser.h
merged from lp:~donkult/apt/sid
[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/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 std::vector<std::string> Architectures;
36 bool MultiArchEnabled;
37
38 unsigned long UniqFindTagWrite(const char *Tag);
39 bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
40 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
41 unsigned int Type);
42 bool ParseProvides(pkgCache::VerIterator &Ver);
43 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
44 static bool GrabWord(string Word,WordList *List,unsigned char &Out);
45
46 public:
47
48 static unsigned char GetPrio(string Str);
49
50 // These all operate against the current section
51 virtual string Package();
52 virtual string Architecture();
53 virtual bool ArchitectureAll();
54 virtual string Version();
55 virtual bool NewVersion(pkgCache::VerIterator &Ver);
56 virtual string Description();
57 virtual string DescriptionLanguage();
58 virtual MD5SumValue Description_md5();
59 virtual unsigned short VersionHash();
60 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
61 pkgCache::VerIterator &Ver);
62 virtual unsigned long Offset() {return iOffset;};
63 virtual unsigned long Size() {return Section.size();};
64
65 virtual bool Step();
66
67 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
68 string section);
69
70 static const char *ParseDepends(const char *Start,const char *Stop,
71 string &Package,string &Ver,unsigned int &Op,
72 bool const &ParseArchFlags = false,
73 bool const &StripMultiArch = true);
74 static const char *ConvertRelation(const char *I,unsigned int &Op);
75
76 debListParser(FileFd *File, string const &Arch = "");
77 };
78
79 #endif