add a first round of stuff needed for talking between APT and solvers
[ntk/apt.git] / apt-pkg / deb / deblistparser.h
CommitLineData
f55a958f
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
b2e465d6 3// $Id: deblistparser.h,v 1.9 2001/02/20 07:03:17 jgg Exp $
f55a958f
AL
4/* ######################################################################
5
6 Debian Package List Parser - This implements the abstract parser
7 interface for Debian package files
8
9 ##################################################################### */
10 /*}}}*/
f55a958f
AL
11#ifndef PKGLIB_DEBLISTPARSER_H
12#define PKGLIB_DEBLISTPARSER_H
13
094a497d 14#include <apt-pkg/pkgcachegen.h>
a52f938b 15#include <apt-pkg/indexfile.h>
094a497d 16#include <apt-pkg/tagfile.h>
f55a958f
AL
17
18class debListParser : public pkgCacheGenerator::ListParser
19{
b2e465d6
AL
20 public:
21
f55a958f
AL
22 // Parser Helper
23 struct WordList
24 {
b2e465d6 25 const char *Str;
f55a958f
AL
26 unsigned char Val;
27 };
6d38011b
DK
28
29 protected:
30
b2e465d6
AL
31 pkgTagFile Tags;
32 pkgTagSection Section;
33 unsigned long iOffset;
34 string Arch;
dcfa253f
DK
35 std::vector<std::string> Architectures;
36 bool MultiArchEnabled;
37
f55a958f 38 unsigned long UniqFindTagWrite(const char *Tag);
6d38011b 39 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
32b9a14c 40 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
dcb79bae 41 unsigned int Type);
32b9a14c 42 bool ParseProvides(pkgCache::VerIterator &Ver);
60dcec6d 43 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
b2e465d6 44 static bool GrabWord(string Word,WordList *List,unsigned char &Out);
f55a958f
AL
45
46 public:
b2e465d6
AL
47
48 static unsigned char GetPrio(string Str);
49
f55a958f
AL
50 // These all operate against the current section
51 virtual string Package();
5bf15716 52 virtual string Architecture();
857e9c13 53 virtual bool ArchitectureAll();
f55a958f 54 virtual string Version();
32b9a14c 55 virtual bool NewVersion(pkgCache::VerIterator &Ver);
a52f938b
OS
56 virtual string Description();
57 virtual string DescriptionLanguage();
58 virtual MD5SumValue Description_md5();
204fbdcc 59 virtual unsigned short VersionHash();
32b9a14c
DK
60 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
61 pkgCache::VerIterator &Ver);
dcb79bae
AL
62 virtual unsigned long Offset() {return iOffset;};
63 virtual unsigned long Size() {return Section.size();};
f55a958f
AL
64
65 virtual bool Step();
b2e465d6 66
32b9a14c 67 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
e011829d 68 string section);
f55a958f 69
b2e465d6
AL
70 static const char *ParseDepends(const char *Start,const char *Stop,
71 string &Package,string &Ver,unsigned int &Op,
41c81fd8 72 bool const &ParseArchFlags = false,
889c669b 73 bool const &StripMultiArch = true);
b2e465d6
AL
74 static const char *ConvertRelation(const char *I,unsigned int &Op);
75
5dd4c8b8 76 debListParser(FileFd *File, string const &Arch = "");
f55a958f
AL
77};
78
79#endif