home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / usr / include / apt-pkg / deblistparser.h < prev    next >
C/C++ Source or Header  |  1999-06-21  |  2KB  |  60 lines

  1. // -*- mode: cpp; mode: fold -*-
  2. // Description                                /*{{{*/
  3. // $Id: deblistparser.h,v 1.7 1999/05/23 22:55:55 jgg Exp $
  4. /* ######################################################################
  5.    
  6.    Debian Package List Parser - This implements the abstract parser 
  7.    interface for Debian package files
  8.    
  9.    ##################################################################### */
  10.                                     /*}}}*/
  11. // Header section: pkglib
  12. #ifndef PKGLIB_DEBLISTPARSER_H
  13. #define PKGLIB_DEBLISTPARSER_H
  14.  
  15. #include <apt-pkg/pkgcachegen.h>
  16. #include <apt-pkg/tagfile.h>
  17.  
  18. class debListParser : public pkgCacheGenerator::ListParser
  19. {
  20.    pkgTagFile Tags;
  21.    pkgTagSection Section;
  22.    unsigned long iOffset;
  23.    
  24.    // Parser Helper
  25.    struct WordList
  26.    {
  27.       char *Str;
  28.       unsigned char Val;
  29.    };
  30.    
  31.    unsigned long UniqFindTagWrite(const char *Tag);
  32.    bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
  33.    const char *ParseDepends(const char *Start,const char *Stop,
  34.                 string &Package,string &Ver,unsigned int &Op);
  35.    bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag,
  36.              unsigned int Type);
  37.    bool ParseProvides(pkgCache::VerIterator Ver);
  38.    bool GrabWord(string Word,WordList *List,int Count,unsigned char &Out);
  39.    
  40.    public:
  41.    
  42.    // These all operate against the current section
  43.    virtual string Package();
  44.    virtual string Version();
  45.    virtual bool NewVersion(pkgCache::VerIterator Ver);
  46.    virtual unsigned short VersionHash();
  47.    virtual bool UsePackage(pkgCache::PkgIterator Pkg,
  48.                pkgCache::VerIterator Ver);
  49.    virtual unsigned long Offset() {return iOffset;};
  50.    virtual unsigned long Size() {return Section.size();};
  51.  
  52.    virtual bool Step();
  53.  
  54.    bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File);
  55.    
  56.    debListParser(FileFd &File);
  57. };
  58.  
  59. #endif
  60.