apt @VERSION@
deblistparser.h
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:
00031    void *d;
00032 
00033    protected:
00034    pkgTagFile Tags;
00035    pkgTagSection Section;
00036    unsigned long iOffset;
00037    string Arch;
00038    std::vector<std::string> Architectures;
00039    bool MultiArchEnabled;
00040 
00041    unsigned long UniqFindTagWrite(const char *Tag);
00042    virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
00043    bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
00044                      unsigned int Type);
00045    bool ParseProvides(pkgCache::VerIterator &Ver);
00046    bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
00047    static bool GrabWord(string Word,WordList *List,unsigned char &Out);
00048    
00049    public:
00050 
00051    static unsigned char GetPrio(string Str);
00052       
00053    // These all operate against the current section
00054    virtual string Package();
00055    virtual string Architecture();
00056    virtual bool ArchitectureAll();
00057    virtual string Version();
00058    virtual bool NewVersion(pkgCache::VerIterator &Ver);
00059    virtual string Description();
00060    virtual string DescriptionLanguage();
00061    virtual MD5SumValue Description_md5();
00062    virtual unsigned short VersionHash();
00063    virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
00064                            pkgCache::VerIterator &Ver);
00065    virtual unsigned long Offset() {return iOffset;};
00066    virtual unsigned long Size() {return Section.size();};
00067 
00068    virtual bool Step();
00069    
00070    bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
00071                         string section);
00072    
00073    static const char *ParseDepends(const char *Start,const char *Stop,
00074                             string &Package,string &Ver,unsigned int &Op,
00075                             bool const &ParseArchFlags = false,
00076                             bool const &StripMultiArch = true);
00077    static const char *ConvertRelation(const char *I,unsigned int &Op);
00078 
00079    debListParser(FileFd *File, string const &Arch = "");
00080    virtual ~debListParser() {};
00081 };
00082 
00083 #endif