1 // -*- mode: cpp; mode: fold -*-
3 // $Id: deblistparser.h,v 1.9 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
6 Debian Package List Parser - This implements the abstract parser
7 interface for Debian package files
9 ##################################################################### */
11 #ifndef PKGLIB_DEBLISTPARSER_H
12 #define PKGLIB_DEBLISTPARSER_H
14 #include <apt-pkg/pkgcachegen.h>
15 #include <apt-pkg/tagfile.h>
16 #include <apt-pkg/md5.h>
17 #include <apt-pkg/pkgcache.h>
18 #include <apt-pkg/macros.h>
23 #ifndef APT_8_CLEANER_HEADERS
24 #include <apt-pkg/indexfile.h>
29 class APT_HIDDEN debListParser
: public pkgCacheListParser
41 /** \brief dpointer placeholder (for later in case we need it) */
46 pkgTagSection Section
;
47 map_filesize_t iOffset
;
49 virtual bool ParseStatus(pkgCache::PkgIterator
&Pkg
,pkgCache::VerIterator
&Ver
);
50 bool ParseDepends(pkgCache::VerIterator
&Ver
,const char *Tag
,
52 bool ParseProvides(pkgCache::VerIterator
&Ver
);
53 static bool GrabWord(std::string Word
,WordList
*List
,unsigned char &Out
);
54 APT_HIDDEN
unsigned char ParseMultiArch(bool const showErrors
);
58 APT_PUBLIC
static unsigned char GetPrio(std::string Str
);
60 // These all operate against the current section
61 virtual std::string
Package() APT_OVERRIDE
;
62 virtual std::string
Architecture() APT_OVERRIDE
;
63 virtual bool ArchitectureAll() APT_OVERRIDE
;
64 virtual std::string
Version() APT_OVERRIDE
;
65 virtual bool NewVersion(pkgCache::VerIterator
&Ver
) APT_OVERRIDE
;
66 virtual std::string
Description(std::string
const &lang
) APT_OVERRIDE
;
67 virtual std::vector
<std::string
> AvailableDescriptionLanguages() APT_OVERRIDE
;
68 virtual MD5SumValue
Description_md5() APT_OVERRIDE
;
69 virtual unsigned short VersionHash() APT_OVERRIDE
;
70 virtual bool SameVersion(unsigned short const Hash
, pkgCache::VerIterator
const &Ver
) APT_OVERRIDE
;
71 virtual bool UsePackage(pkgCache::PkgIterator
&Pkg
,
72 pkgCache::VerIterator
&Ver
) APT_OVERRIDE
;
73 virtual map_filesize_t
Offset() APT_OVERRIDE
{return iOffset
;};
74 virtual map_filesize_t
Size() APT_OVERRIDE
{return Section
.size();};
76 virtual bool Step() APT_OVERRIDE
;
78 bool LoadReleaseInfo(pkgCache::RlsFileIterator
&FileI
,FileFd
&File
,
79 std::string
const §ion
);
81 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
82 std::string
&Package
,std::string
&Ver
,unsigned int &Op
);
83 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
84 std::string
&Package
,std::string
&Ver
,unsigned int &Op
,
85 bool const &ParseArchFlags
);
86 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
87 std::string
&Package
,std::string
&Ver
,unsigned int &Op
,
88 bool const &ParseArchFlags
, bool const &StripMultiArch
);
89 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
90 std::string
&Package
,std::string
&Ver
,unsigned int &Op
,
91 bool const &ParseArchFlags
, bool const &StripMultiArch
,
92 bool const &ParseRestrictionsList
);
94 APT_PUBLIC
static const char *ConvertRelation(const char *I
,unsigned int &Op
);
96 debListParser(FileFd
*File
);
97 virtual ~debListParser();
100 class APT_HIDDEN debDebFileParser
: public debListParser
106 debDebFileParser(FileFd
*File
, std::string
const &DebFile
);
107 virtual bool UsePackage(pkgCache::PkgIterator
&Pkg
,
108 pkgCache::VerIterator
&Ver
) APT_OVERRIDE
;
111 class APT_HIDDEN debTranslationsParser
: public debListParser
114 // a translation can never be a real package
115 virtual std::string
Architecture() APT_OVERRIDE
{ return ""; }
116 virtual std::string
Version() APT_OVERRIDE
{ return ""; }
118 debTranslationsParser(FileFd
*File
)
119 : debListParser(File
) {};
122 class APT_HIDDEN debStatusListParser
: public debListParser
125 virtual bool ParseStatus(pkgCache::PkgIterator
&Pkg
,pkgCache::VerIterator
&Ver
);
126 debStatusListParser(FileFd
*File
)
127 : debListParser(File
) {};