]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/deblistparser.h
Prepare release 1.1~exp17
[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
c9443c01 29class APT_HIDDEN debListParser : public pkgCacheListParser
f55a958f 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 41 /** \brief dpointer placeholder (for later in case we need it) */
6c55f07a 42 void * const d;
6d38011b 43
36b8ebbb 44 protected:
b2e465d6
AL
45 pkgTagFile Tags;
46 pkgTagSection Section;
4ad8619b 47 map_filesize_t iOffset;
dcfa253f 48
6d38011b 49 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
32b9a14c 50 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
dcb79bae 51 unsigned int Type);
32b9a14c 52 bool ParseProvides(pkgCache::VerIterator &Ver);
f77ea39c 53 static bool GrabWord(std::string Word,const WordList *List,unsigned char &Out);
0d29b9d4
MV
54 APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
55
f55a958f 56 public:
b2e465d6 57
dce45dbe 58 APT_PUBLIC static unsigned char GetPrio(std::string Str);
b2e465d6 59
f55a958f 60 // These all operate against the current section
3b302846
DK
61 virtual std::string Package() APT_OVERRIDE;
62 virtual std::string Architecture() APT_OVERRIDE;
63 virtual bool ArchitectureAll() APT_OVERRIDE;
64 virtual std::string Version() APT_OVERRIDE;
65 virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
66 virtual std::string Description(std::string const &lang) APT_OVERRIDE;
67 virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
68 virtual MD5SumValue Description_md5() APT_OVERRIDE;
69 virtual unsigned short VersionHash() APT_OVERRIDE;
3b302846 70 virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
32b9a14c 71 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
3b302846
DK
72 pkgCache::VerIterator &Ver) APT_OVERRIDE;
73 virtual map_filesize_t Offset() APT_OVERRIDE {return iOffset;};
74 virtual map_filesize_t Size() APT_OVERRIDE {return Section.size();};
f55a958f 75
3b302846 76 virtual bool Step() APT_OVERRIDE;
b07aeb1a
DK
77
78 bool LoadReleaseInfo(pkgCache::RlsFileIterator &FileI,FileFd &File,
79 std::string const &section);
565ded7b 80
dce45dbe 81 APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
565ded7b 82 std::string &Package,std::string &Ver,unsigned int &Op);
dce45dbe 83 APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
565ded7b
JS
84 std::string &Package,std::string &Ver,unsigned int &Op,
85 bool const &ParseArchFlags);
dce45dbe 86 APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
565ded7b
JS
87 std::string &Package,std::string &Ver,unsigned int &Op,
88 bool const &ParseArchFlags, bool const &StripMultiArch);
dce45dbe 89 APT_PUBLIC 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, bool const &StripMultiArch,
92 bool const &ParseRestrictionsList);
93
dce45dbe 94 APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);
b2e465d6 95
7f8c0eed 96 debListParser(FileFd *File);
862bafea 97 virtual ~debListParser();
0d29b9d4 98};
e33dbfe5 99
dce45dbe 100class APT_HIDDEN debDebFileParser : public debListParser
0d29b9d4
MV
101{
102 private:
103 std::string DebFile;
104
105 public:
106 debDebFileParser(FileFd *File, std::string const &DebFile);
107 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
3b302846 108 pkgCache::VerIterator &Ver) APT_OVERRIDE;
f55a958f
AL
109};
110
dce45dbe 111class APT_HIDDEN debTranslationsParser : public debListParser
bc1c9081
MV
112{
113 public:
114 // a translation can never be a real package
3b302846
DK
115 virtual std::string Architecture() APT_OVERRIDE { return ""; }
116 virtual std::string Version() APT_OVERRIDE { return ""; }
bc1c9081 117
7f8c0eed
DK
118 debTranslationsParser(FileFd *File)
119 : debListParser(File) {};
bc1c9081
MV
120};
121
1c73b0fc
JAK
122class APT_HIDDEN debStatusListParser : public debListParser
123{
124 public:
125 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
126 debStatusListParser(FileFd *File)
127 : debListParser(File) {};
128};
f55a958f 129#endif