deblistparser.h 1.8 KB

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