]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/deblistparser.h
don't perform implicit crossgrades involving M-A:same
[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
3b4045fc 36#ifdef APT_PKG_EXPOSE_STRING_VIEW
f55a958f
AL
37 // Parser Helper
38 struct WordList
39 {
3b4045fc 40 APT::StringView Str;
f55a958f
AL
41 unsigned char Val;
42 };
3b4045fc 43#endif
6d38011b 44
b2e465d6 45 private:
a9b724ee
DK
46 std::vector<std::string> forceEssential;
47 std::vector<std::string> forceImportant;
49521f87 48 std::string MD5Buffer;
6d38011b 49
36b8ebbb 50 protected:
b2e465d6
AL
51 pkgTagFile Tags;
52 pkgTagSection Section;
4ad8619b 53 map_filesize_t iOffset;
dcfa253f 54
6d38011b 55 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
5664bb20 56 bool ParseDepends(pkgCache::VerIterator &Ver, pkgTagSection::Key Key,
dcb79bae 57 unsigned int Type);
32b9a14c 58 bool ParseProvides(pkgCache::VerIterator &Ver);
eff0c22e
JAK
59
60#ifdef APT_PKG_EXPOSE_STRING_VIEW
61 APT_HIDDEN static bool GrabWord(APT::StringView Word,const WordList *List,unsigned char &Out);
62#endif
0d29b9d4
MV
63 APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
64
f55a958f 65 public:
b2e465d6 66
dce45dbe 67 APT_PUBLIC static unsigned char GetPrio(std::string Str);
b2e465d6 68
f55a958f 69 // These all operate against the current section
3b302846 70 virtual std::string Package() APT_OVERRIDE;
3b302846 71 virtual bool ArchitectureAll() APT_OVERRIDE;
8efd5947
DK
72#ifdef APT_PKG_EXPOSE_STRING_VIEW
73 virtual APT::StringView Architecture() APT_OVERRIDE;
74 virtual APT::StringView Version() APT_OVERRIDE;
75#endif
3b302846 76 virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
3b302846 77 virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
49521f87
JAK
78#ifdef APT_PKG_EXPOSE_STRING_VIEW
79 virtual APT::StringView Description_md5() APT_OVERRIDE;
80#endif
3b302846 81 virtual unsigned short VersionHash() APT_OVERRIDE;
3b302846 82 virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver) APT_OVERRIDE;
32b9a14c 83 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
3b302846
DK
84 pkgCache::VerIterator &Ver) APT_OVERRIDE;
85 virtual map_filesize_t Offset() APT_OVERRIDE {return iOffset;};
86 virtual map_filesize_t Size() APT_OVERRIDE {return Section.size();};
f55a958f 87
3b302846 88 virtual bool Step() APT_OVERRIDE;
b07aeb1a
DK
89
90 bool LoadReleaseInfo(pkgCache::RlsFileIterator &FileI,FileFd &File,
91 std::string const &section);
565ded7b 92
dce45dbe 93 APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
565ded7b 94 std::string &Package,std::string &Ver,unsigned int &Op);
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);
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);
dce45dbe 101 APT_PUBLIC static const char *ParseDepends(const char *Start,const char *Stop,
565ded7b
JS
102 std::string &Package,std::string &Ver,unsigned int &Op,
103 bool const &ParseArchFlags, bool const &StripMultiArch,
104 bool const &ParseRestrictionsList);
105
eff0c22e
JAK
106#ifdef APT_PKG_EXPOSE_STRING_VIEW
107 APT_HIDDEN static const char *ParseDepends(const char *Start,const char *Stop,
108 APT::StringView &Package,
109 APT::StringView &Ver,unsigned int &Op,
110 bool const ParseArchFlags = false, bool StripMultiArch = true,
111 bool const ParseRestrictionsList = false);
112#endif
113
dce45dbe 114 APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);
b2e465d6 115
7f8c0eed 116 debListParser(FileFd *File);
862bafea 117 virtual ~debListParser();
0d29b9d4 118};
e33dbfe5 119
dce45dbe 120class APT_HIDDEN debDebFileParser : public debListParser
0d29b9d4
MV
121{
122 private:
123 std::string DebFile;
124
125 public:
126 debDebFileParser(FileFd *File, std::string const &DebFile);
127 virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
3b302846 128 pkgCache::VerIterator &Ver) APT_OVERRIDE;
f55a958f
AL
129};
130
dce45dbe 131class APT_HIDDEN debTranslationsParser : public debListParser
bc1c9081
MV
132{
133 public:
8efd5947 134#ifdef APT_PKG_EXPOSE_STRING_VIEW
bc1c9081 135 // a translation can never be a real package
8efd5947
DK
136 virtual APT::StringView Architecture() APT_OVERRIDE { return ""; }
137 virtual APT::StringView Version() APT_OVERRIDE { return ""; }
138#endif
bc1c9081 139
7f8c0eed
DK
140 debTranslationsParser(FileFd *File)
141 : debListParser(File) {};
bc1c9081
MV
142};
143
1c73b0fc
JAK
144class APT_HIDDEN debStatusListParser : public debListParser
145{
146 public:
147 virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
148 debStatusListParser(FileFd *File)
149 : debListParser(File) {};
150};
f55a958f 151#endif