]>
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> | |
f55a958f | 22 | |
b9dadc24 DK |
23 | #ifndef APT_8_CLEANER_HEADERS |
24 | #include <apt-pkg/indexfile.h> | |
25 | #endif | |
26 | ||
453b82a3 DK |
27 | class FileFd; |
28 | ||
f55a958f AL |
29 | class 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; | |
4ad8619b | 47 | map_filesize_t iOffset; |
8f3ba4e8 | 48 | std::string Arch; |
dcfa253f DK |
49 | std::vector<std::string> Architectures; |
50 | bool MultiArchEnabled; | |
51 | ||
4ad8619b | 52 | map_stringitem_t 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); | |
0d29b9d4 MV |
59 | APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors); |
60 | ||
f55a958f | 61 | public: |
b2e465d6 | 62 | |
8f3ba4e8 | 63 | static unsigned char GetPrio(std::string Str); |
b2e465d6 | 64 | |
f55a958f | 65 | // These all operate against the current section |
8f3ba4e8 DK |
66 | virtual std::string Package(); |
67 | virtual std::string Architecture(); | |
857e9c13 | 68 | virtual bool ArchitectureAll(); |
8f3ba4e8 | 69 | virtual std::string Version(); |
32b9a14c | 70 | virtual bool NewVersion(pkgCache::VerIterator &Ver); |
ffe3c68e DK |
71 | virtual std::string Description(std::string const &lang); |
72 | virtual std::vector<std::string> AvailableDescriptionLanguages(); | |
a52f938b | 73 | virtual MD5SumValue Description_md5(); |
204fbdcc | 74 | virtual unsigned short VersionHash(); |
68134bda DK |
75 | #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) |
76 | virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); | |
77 | #endif | |
32b9a14c DK |
78 | virtual bool UsePackage(pkgCache::PkgIterator &Pkg, |
79 | pkgCache::VerIterator &Ver); | |
4ad8619b DK |
80 | virtual map_filesize_t Offset() {return iOffset;}; |
81 | virtual map_filesize_t Size() {return Section.size();}; | |
f55a958f AL |
82 | |
83 | virtual bool Step(); | |
b2e465d6 | 84 | |
32b9a14c | 85 | bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, |
8f3ba4e8 | 86 | std::string section); |
565ded7b JS |
87 | |
88 | static const char *ParseDepends(const char *Start,const char *Stop, | |
89 | std::string &Package,std::string &Ver,unsigned int &Op); | |
b2e465d6 | 90 | static const char *ParseDepends(const char *Start,const char *Stop, |
565ded7b JS |
91 | std::string &Package,std::string &Ver,unsigned int &Op, |
92 | bool const &ParseArchFlags); | |
93 | static const char *ParseDepends(const char *Start,const char *Stop, | |
94 | std::string &Package,std::string &Ver,unsigned int &Op, | |
95 | bool const &ParseArchFlags, bool const &StripMultiArch); | |
96 | static const char *ParseDepends(const char *Start,const char *Stop, | |
97 | std::string &Package,std::string &Ver,unsigned int &Op, | |
98 | bool const &ParseArchFlags, bool const &StripMultiArch, | |
99 | bool const &ParseRestrictionsList); | |
100 | ||
b2e465d6 AL |
101 | static const char *ConvertRelation(const char *I,unsigned int &Op); |
102 | ||
8f3ba4e8 | 103 | debListParser(FileFd *File, std::string const &Arch = ""); |
ff72bd0d | 104 | virtual ~debListParser() {}; |
0d29b9d4 | 105 | }; |
e33dbfe5 | 106 | |
0d29b9d4 MV |
107 | class debDebFileParser : public debListParser |
108 | { | |
109 | private: | |
110 | std::string DebFile; | |
111 | ||
112 | public: | |
113 | debDebFileParser(FileFd *File, std::string const &DebFile); | |
114 | virtual bool UsePackage(pkgCache::PkgIterator &Pkg, | |
115 | pkgCache::VerIterator &Ver); | |
f55a958f AL |
116 | }; |
117 | ||
bc1c9081 MV |
118 | class debTranslationsParser : public debListParser |
119 | { | |
120 | public: | |
121 | // a translation can never be a real package | |
122 | virtual std::string Architecture() { return ""; } | |
123 | virtual std::string Version() { return ""; } | |
124 | ||
125 | debTranslationsParser(FileFd *File, std::string const &Arch = "") | |
126 | : debListParser(File, Arch) {}; | |
127 | }; | |
128 | ||
f55a958f | 129 | #endif |