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