Merge remote-tracking branch 'mvo/feature/apt-manpage' into debian/sid
[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>
453b82a3
DK
16#include <apt-pkg/md5.h>
17#include <apt-pkg/pkgcache.h>
ce62f1de 18#include <apt-pkg/macros.h>
453b82a3
DK
19
20#include <string>
21#include <vector>
f55a958f 22
b9dadc24
DK
23#ifndef APT_8_CLEANER_HEADERS
24#include <apt-pkg/indexfile.h>
25#endif
26
453b82a3
DK
27class FileFd;
28
f55a958f
AL
29class debListParser : public pkgCacheGenerator::ListParser
30{
b2e465d6
AL
31 public:
32
f55a958f
AL
33 // Parser Helper
34 struct WordList
35 {
b2e465d6 36 const char *Str;
f55a958f
AL
37 unsigned char Val;
38 };
6d38011b 39
b2e465d6 40 private:
ff72bd0d
MV
41 /** \brief dpointer placeholder (for later in case we need it) */
42 void *d;
6d38011b 43
36b8ebbb 44 protected:
b2e465d6
AL
45 pkgTagFile Tags;
46 pkgTagSection Section;
47 unsigned long iOffset;
8f3ba4e8 48 std::string Arch;
dcfa253f
DK
49 std::vector<std::string> Architectures;
50 bool MultiArchEnabled;
51
f55a958f 52 unsigned long UniqFindTagWrite(const char *Tag);
6d38011b 53 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
32b9a14c 54 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
dcb79bae 55 unsigned int Type);
32b9a14c 56 bool ParseProvides(pkgCache::VerIterator &Ver);
8f3ba4e8
DK
57 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version);
58 static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
f55a958f
AL
59
60 public:
b2e465d6 61
8f3ba4e8 62 static unsigned char GetPrio(std::string Str);
b2e465d6 63
f55a958f 64 // These all operate against the current section
8f3ba4e8
DK
65 virtual std::string Package();
66 virtual std::string Architecture();
857e9c13 67 virtual bool ArchitectureAll();
8f3ba4e8 68 virtual std::string Version();
32b9a14c 69 virtual bool NewVersion(pkgCache::VerIterator &Ver);
8f3ba4e8
DK
70 virtual std::string Description();
71 virtual std::string DescriptionLanguage();
a52f938b 72 virtual MD5SumValue Description_md5();
204fbdcc 73 virtual unsigned short VersionHash();
68134bda
DK
74#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
75 virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver);
76#endif
32b9a14c
DK
77 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
78 pkgCache::VerIterator &Ver);
dcb79bae
AL
79 virtual unsigned long Offset() {return iOffset;};
80 virtual unsigned long Size() {return Section.size();};
f55a958f
AL
81
82 virtual bool Step();
b2e465d6 83
32b9a14c 84 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
8f3ba4e8 85 std::string section);
565ded7b
JS
86
87 static const char *ParseDepends(const char *Start,const char *Stop,
88 std::string &Package,std::string &Ver,unsigned int &Op);
b2e465d6 89 static const char *ParseDepends(const char *Start,const char *Stop,
565ded7b
JS
90 std::string &Package,std::string &Ver,unsigned int &Op,
91 bool const &ParseArchFlags);
92 static const char *ParseDepends(const char *Start,const char *Stop,
93 std::string &Package,std::string &Ver,unsigned int &Op,
94 bool const &ParseArchFlags, bool const &StripMultiArch);
95 static const char *ParseDepends(const char *Start,const char *Stop,
96 std::string &Package,std::string &Ver,unsigned int &Op,
97 bool const &ParseArchFlags, bool const &StripMultiArch,
98 bool const &ParseRestrictionsList);
99
b2e465d6
AL
100 static const char *ConvertRelation(const char *I,unsigned int &Op);
101
8f3ba4e8 102 debListParser(FileFd *File, std::string const &Arch = "");
ff72bd0d 103 virtual ~debListParser() {};
e33dbfe5
DK
104
105 private:
ce62f1de 106 APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
f55a958f
AL
107};
108
109#endif