apt @VERSION@
|
00001 // -*- mode: cpp; mode: fold -*- 00002 // Description /*{{{*/ 00003 // $Id: deblistparser.h,v 1.9 2001/02/20 07:03:17 jgg Exp $ 00004 /* ###################################################################### 00005 00006 Debian Package List Parser - This implements the abstract parser 00007 interface for Debian package files 00008 00009 ##################################################################### */ 00010 /*}}}*/ 00011 #ifndef PKGLIB_DEBLISTPARSER_H 00012 #define PKGLIB_DEBLISTPARSER_H 00013 00014 #include <apt-pkg/pkgcachegen.h> 00015 #include <apt-pkg/indexfile.h> 00016 #include <apt-pkg/tagfile.h> 00017 00018 class debListParser : public pkgCacheGenerator::ListParser 00019 { 00020 public: 00021 00022 // Parser Helper 00023 struct WordList 00024 { 00025 const char *Str; 00026 unsigned char Val; 00027 }; 00028 00029 private: 00030 00031 pkgTagFile Tags; 00032 pkgTagSection Section; 00033 unsigned long iOffset; 00034 string Arch; 00035 std::vector<std::string> Architectures; 00036 bool MultiArchEnabled; 00037 00038 unsigned long UniqFindTagWrite(const char *Tag); 00039 bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); 00040 bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag, 00041 unsigned int Type); 00042 bool ParseProvides(pkgCache::VerIterator &Ver); 00043 bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version); 00044 static bool GrabWord(string Word,WordList *List,unsigned char &Out); 00045 00046 public: 00047 00048 static unsigned char GetPrio(string Str); 00049 00050 // These all operate against the current section 00051 virtual string Package(); 00052 virtual string Architecture(); 00053 virtual bool ArchitectureAll(); 00054 virtual string Version(); 00055 virtual bool NewVersion(pkgCache::VerIterator &Ver); 00056 virtual string Description(); 00057 virtual string DescriptionLanguage(); 00058 virtual MD5SumValue Description_md5(); 00059 virtual unsigned short VersionHash(); 00060 virtual bool UsePackage(pkgCache::PkgIterator &Pkg, 00061 pkgCache::VerIterator &Ver); 00062 virtual unsigned long Offset() {return iOffset;}; 00063 virtual unsigned long Size() {return Section.size();}; 00064 00065 virtual bool Step(); 00066 00067 bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, 00068 string section); 00069 00070 static const char *ParseDepends(const char *Start,const char *Stop, 00071 string &Package,string &Ver,unsigned int &Op, 00072 bool const &ParseArchFlags = false, 00073 bool const &StripMultiArch = true); 00074 static const char *ConvertRelation(const char *I,unsigned int &Op); 00075 00076 debListParser(FileFd *File, string const &Arch = ""); 00077 }; 00078 00079 #endif