Merge remote-tracking branch 'donkult/feature/clientmergepdiffs' into debian/experime...
[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
AL
14#include <apt-pkg/pkgcachegen.h>
15#include <apt-pkg/tagfile.h>
f55a958f 16
b9dadc24
DK
17#ifndef APT_8_CLEANER_HEADERS
18#include <apt-pkg/indexfile.h>
19#endif
20
f55a958f
AL
21class debListParser : public pkgCacheGenerator::ListParser
22{
b2e465d6
AL
23 public:
24
f55a958f
AL
25 // Parser Helper
26 struct WordList
27 {
b2e465d6 28 const char *Str;
f55a958f
AL
29 unsigned char Val;
30 };
6d38011b 31
b2e465d6 32 private:
ff72bd0d
MV
33 /** \brief dpointer placeholder (for later in case we need it) */
34 void *d;
6d38011b 35
36b8ebbb 36 protected:
b2e465d6
AL
37 pkgTagFile Tags;
38 pkgTagSection Section;
39 unsigned long iOffset;
8f3ba4e8 40 std::string Arch;
dcfa253f
DK
41 std::vector<std::string> Architectures;
42 bool MultiArchEnabled;
43
f55a958f 44 unsigned long UniqFindTagWrite(const char *Tag);
6d38011b 45 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
32b9a14c 46 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
dcb79bae 47 unsigned int Type);
32b9a14c 48 bool ParseProvides(pkgCache::VerIterator &Ver);
8f3ba4e8
DK
49 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version);
50 static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
f55a958f
AL
51
52 public:
b2e465d6 53
8f3ba4e8 54 static unsigned char GetPrio(std::string Str);
b2e465d6 55
f55a958f 56 // These all operate against the current section
8f3ba4e8
DK
57 virtual std::string Package();
58 virtual std::string Architecture();
857e9c13 59 virtual bool ArchitectureAll();
8f3ba4e8 60 virtual std::string Version();
32b9a14c 61 virtual bool NewVersion(pkgCache::VerIterator &Ver);
8f3ba4e8
DK
62 virtual std::string Description();
63 virtual std::string DescriptionLanguage();
a52f938b 64 virtual MD5SumValue Description_md5();
204fbdcc 65 virtual unsigned short VersionHash();
32b9a14c
DK
66 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
67 pkgCache::VerIterator &Ver);
dcb79bae
AL
68 virtual unsigned long Offset() {return iOffset;};
69 virtual unsigned long Size() {return Section.size();};
f55a958f
AL
70
71 virtual bool Step();
b2e465d6 72
32b9a14c 73 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
8f3ba4e8 74 std::string section);
f55a958f 75
b2e465d6 76 static const char *ParseDepends(const char *Start,const char *Stop,
8f3ba4e8 77 std::string &Package,std::string &Ver,unsigned int &Op,
41c81fd8 78 bool const &ParseArchFlags = false,
889c669b 79 bool const &StripMultiArch = true);
b2e465d6
AL
80 static const char *ConvertRelation(const char *I,unsigned int &Op);
81
8f3ba4e8 82 debListParser(FileFd *File, std::string const &Arch = "");
ff72bd0d 83 virtual ~debListParser() {};
f55a958f
AL
84};
85
86#endif