]>
git.saurik.com Git - apt.git/blob - apt-pkg/deb/deblistparser.h
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 debListParser
: public pkgCacheGenerator::ListParser
41 /** \brief dpointer placeholder (for later in case we need it) */
46 pkgTagSection Section
;
47 unsigned long iOffset
;
49 std::vector
<std::string
> Architectures
;
50 bool MultiArchEnabled
;
52 unsigned long UniqFindTagWrite(const char *Tag
);
53 virtual bool ParseStatus(pkgCache::PkgIterator
&Pkg
,pkgCache::VerIterator
&Ver
);
54 bool ParseDepends(pkgCache::VerIterator
&Ver
,const char *Tag
,
56 bool ParseProvides(pkgCache::VerIterator
&Ver
);
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
);
59 APT_HIDDEN
unsigned char ParseMultiArch(bool const showErrors
);
63 static unsigned char GetPrio(std::string Str
);
65 // These all operate against the current section
66 virtual std::string
Package();
67 virtual std::string
Architecture();
68 virtual bool ArchitectureAll();
69 virtual std::string
Version();
70 virtual bool NewVersion(pkgCache::VerIterator
&Ver
);
71 virtual std::string
Description(std::string
const &lang
);
72 virtual std::vector
<std::string
> AvailableDescriptionLanguages();
73 virtual MD5SumValue
Description_md5();
74 virtual unsigned short VersionHash();
75 #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13)
76 virtual bool SameVersion(unsigned short const Hash
, pkgCache::VerIterator
const &Ver
);
78 virtual bool UsePackage(pkgCache::PkgIterator
&Pkg
,
79 pkgCache::VerIterator
&Ver
);
80 virtual unsigned long Offset() {return iOffset
;};
81 virtual unsigned long Size() {return Section
.size();};
85 bool LoadReleaseInfo(pkgCache::PkgFileIterator
&FileI
,FileFd
&File
,
88 static const char *ParseDepends(const char *Start
,const char *Stop
,
89 std::string
&Package
,std::string
&Ver
,unsigned int &Op
);
90 static const char *ParseDepends(const char *Start
,const char *Stop
,
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
);
101 static const char *ConvertRelation(const char *I
,unsigned int &Op
);
103 debListParser(FileFd
*File
, std::string
const &Arch
= "");
104 virtual ~debListParser() {};
107 class debDebFileParser
: public debListParser
113 debDebFileParser(FileFd
*File
, std::string
const &DebFile
);
114 virtual bool UsePackage(pkgCache::PkgIterator
&Pkg
,
115 pkgCache::VerIterator
&Ver
);