deblistparser.h 2.0 KB

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