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