]>
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> | |
18 | ||
19 | #include <string> | |
20 | #include <vector> | |
f55a958f | 21 | |
b9dadc24 DK |
22 | #ifndef APT_8_CLEANER_HEADERS |
23 | #include <apt-pkg/indexfile.h> | |
24 | #endif | |
25 | ||
453b82a3 DK |
26 | class FileFd; |
27 | ||
f55a958f AL |
28 | class debListParser : public pkgCacheGenerator::ListParser |
29 | { | |
b2e465d6 AL |
30 | public: |
31 | ||
f55a958f AL |
32 | // Parser Helper |
33 | struct WordList | |
34 | { | |
b2e465d6 | 35 | const char *Str; |
f55a958f AL |
36 | unsigned char Val; |
37 | }; | |
6d38011b | 38 | |
b2e465d6 | 39 | private: |
ff72bd0d MV |
40 | /** \brief dpointer placeholder (for later in case we need it) */ |
41 | void *d; | |
6d38011b | 42 | |
36b8ebbb | 43 | protected: |
b2e465d6 AL |
44 | pkgTagFile Tags; |
45 | pkgTagSection Section; | |
46 | unsigned long iOffset; | |
8f3ba4e8 | 47 | std::string Arch; |
dcfa253f DK |
48 | std::vector<std::string> Architectures; |
49 | bool MultiArchEnabled; | |
50 | ||
f55a958f | 51 | unsigned long UniqFindTagWrite(const char *Tag); |
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); |
8f3ba4e8 DK |
56 | bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version); |
57 | static bool GrabWord(std::string Word,WordList *List,unsigned char &Out); | |
f55a958f AL |
58 | |
59 | public: | |
b2e465d6 | 60 | |
8f3ba4e8 | 61 | static unsigned char GetPrio(std::string Str); |
b2e465d6 | 62 | |
f55a958f | 63 | // These all operate against the current section |
8f3ba4e8 DK |
64 | virtual std::string Package(); |
65 | virtual std::string Architecture(); | |
857e9c13 | 66 | virtual bool ArchitectureAll(); |
8f3ba4e8 | 67 | virtual std::string Version(); |
32b9a14c | 68 | virtual bool NewVersion(pkgCache::VerIterator &Ver); |
8f3ba4e8 DK |
69 | virtual std::string Description(); |
70 | virtual std::string DescriptionLanguage(); | |
a52f938b | 71 | virtual MD5SumValue Description_md5(); |
204fbdcc | 72 | virtual unsigned short VersionHash(); |
68134bda DK |
73 | #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) |
74 | virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); | |
75 | #endif | |
32b9a14c DK |
76 | virtual bool UsePackage(pkgCache::PkgIterator &Pkg, |
77 | pkgCache::VerIterator &Ver); | |
dcb79bae AL |
78 | virtual unsigned long Offset() {return iOffset;}; |
79 | virtual unsigned long Size() {return Section.size();}; | |
f55a958f AL |
80 | |
81 | virtual bool Step(); | |
b2e465d6 | 82 | |
32b9a14c | 83 | bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, |
8f3ba4e8 | 84 | std::string section); |
565ded7b JS |
85 | |
86 | static const char *ParseDepends(const char *Start,const char *Stop, | |
87 | std::string &Package,std::string &Ver,unsigned int &Op); | |
b2e465d6 | 88 | static const char *ParseDepends(const char *Start,const char *Stop, |
565ded7b JS |
89 | std::string &Package,std::string &Ver,unsigned int &Op, |
90 | bool const &ParseArchFlags); | |
91 | static const char *ParseDepends(const char *Start,const char *Stop, | |
92 | std::string &Package,std::string &Ver,unsigned int &Op, | |
93 | bool const &ParseArchFlags, bool const &StripMultiArch); | |
94 | static const char *ParseDepends(const char *Start,const char *Stop, | |
95 | std::string &Package,std::string &Ver,unsigned int &Op, | |
96 | bool const &ParseArchFlags, bool const &StripMultiArch, | |
97 | bool const &ParseRestrictionsList); | |
98 | ||
b2e465d6 AL |
99 | static const char *ConvertRelation(const char *I,unsigned int &Op); |
100 | ||
8f3ba4e8 | 101 | debListParser(FileFd *File, std::string const &Arch = ""); |
ff72bd0d | 102 | virtual ~debListParser() {}; |
e33dbfe5 DK |
103 | |
104 | private: | |
105 | unsigned char ParseMultiArch(bool const showErrors); | |
f55a958f AL |
106 | }; |
107 | ||
108 | #endif |