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