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 pkgCacheGenerator::ListParser
41 /** \brief dpointer placeholder (for later in case we need it) */
46 pkgTagSection Section
;
47 map_filesize_t iOffset
;
49 std::vector
<std::string
> Architectures
;
50 bool MultiArchEnabled
;
52 virtual bool ParseStatus(pkgCache::PkgIterator
&Pkg
,pkgCache::VerIterator
&Ver
);
53 bool ParseDepends(pkgCache::VerIterator
&Ver
,const char *Tag
,
55 bool ParseProvides(pkgCache::VerIterator
&Ver
);
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
);
58 APT_HIDDEN
unsigned char ParseMultiArch(bool const showErrors
);
62 APT_PUBLIC
static unsigned char GetPrio(std::string Str
);
64 // These all operate against the current section
65 virtual std::string
Package();
66 virtual std::string
Architecture();
67 virtual bool ArchitectureAll();
68 virtual std::string
Version();
69 virtual bool NewVersion(pkgCache::VerIterator
&Ver
);
70 virtual std::string
Description(std::string
const &lang
);
71 virtual std::vector
<std::string
> AvailableDescriptionLanguages();
72 virtual MD5SumValue
Description_md5();
73 virtual unsigned short VersionHash();
74 #if APT_PKG_ABI >= 413
75 virtual bool SameVersion(unsigned short const Hash
, pkgCache::VerIterator
const &Ver
);
77 virtual bool UsePackage(pkgCache::PkgIterator
&Pkg
,
78 pkgCache::VerIterator
&Ver
);
79 virtual map_filesize_t
Offset() {return iOffset
;};
80 virtual map_filesize_t
Size() {return Section
.size();};
84 bool LoadReleaseInfo(pkgCache::RlsFileIterator
&FileI
,FileFd
&File
,
85 std::string
const §ion
);
87 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
88 std::string
&Package
,std::string
&Ver
,unsigned int &Op
);
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
);
92 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
93 std::string
&Package
,std::string
&Ver
,unsigned int &Op
,
94 bool const &ParseArchFlags
, bool const &StripMultiArch
);
95 APT_PUBLIC
static const char *ParseDepends(const char *Start
,const char *Stop
,
96 std::string
&Package
,std::string
&Ver
,unsigned int &Op
,
97 bool const &ParseArchFlags
, bool const &StripMultiArch
,
98 bool const &ParseRestrictionsList
);
100 APT_PUBLIC
static const char *ConvertRelation(const char *I
,unsigned int &Op
);
102 debListParser(FileFd
*File
, std::string
const &Arch
= "");
103 virtual ~debListParser();
106 class APT_HIDDEN debDebFileParser
: public debListParser
112 debDebFileParser(FileFd
*File
, std::string
const &DebFile
);
113 virtual bool UsePackage(pkgCache::PkgIterator
&Pkg
,
114 pkgCache::VerIterator
&Ver
);
117 class APT_HIDDEN debTranslationsParser
: public debListParser
120 // a translation can never be a real package
121 virtual std::string
Architecture() { return ""; }
122 virtual std::string
Version() { return ""; }
124 debTranslationsParser(FileFd
*File
, std::string
const &Arch
= "")
125 : debListParser(File
, Arch
) {};