deblistparser.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: deblistparser.h,v 1.5 1998/07/19 04:42:17 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. string FindTag(const char *Tag);
  26. signed long FindTagI(const char *Tag,signed long Default = 0);
  27. unsigned long UniqFindTagWrite(const char *Tag);
  28. bool HandleFlag(const char *Tag,unsigned long &Flags,unsigned long Flag);
  29. bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
  30. const char *ParseDepends(const char *Start,const char *Stop,
  31. string &Package,string &Ver,unsigned int &Op);
  32. bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag,
  33. unsigned int Type);
  34. bool ParseProvides(pkgCache::VerIterator Ver);
  35. bool GrabWord(string Word,WordList *List,int Count,unsigned char &Out);
  36. public:
  37. // These all operate against the current section
  38. virtual string Package();
  39. virtual string Version();
  40. virtual bool NewVersion(pkgCache::VerIterator Ver);
  41. virtual bool UsePackage(pkgCache::PkgIterator Pkg,
  42. pkgCache::VerIterator Ver);
  43. virtual unsigned long Offset() {return iOffset;};
  44. virtual unsigned long Size() {return Section.size();};
  45. virtual bool Step();
  46. debListParser(FileFd &File);
  47. };
  48. #endif