deblistparser.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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/indexfile.h>
  13. #include <apt-pkg/tagfile.h>
  14. class debListParser : public pkgCacheGenerator::ListParser
  15. {
  16. public:
  17. // Parser Helper
  18. struct WordList
  19. {
  20. const char *Str;
  21. unsigned char Val;
  22. };
  23. private:
  24. pkgTagFile Tags;
  25. pkgTagSection Section;
  26. unsigned long iOffset;
  27. string Arch;
  28. unsigned long UniqFindTagWrite(const char *Tag);
  29. bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
  30. bool ParseDepends(pkgCache::VerIterator Ver,const char *Tag,
  31. unsigned int Type);
  32. bool ParseProvides(pkgCache::VerIterator Ver);
  33. static bool GrabWord(string Word,WordList *List,unsigned char &Out);
  34. public:
  35. static unsigned char GetPrio(string Str);
  36. // These all operate against the current section
  37. virtual string Package();
  38. virtual string Version();
  39. virtual bool NewVersion(pkgCache::VerIterator Ver);
  40. virtual string Description();
  41. virtual string DescriptionLanguage();
  42. virtual MD5SumValue Description_md5();
  43. virtual unsigned short VersionHash();
  44. virtual bool UsePackage(pkgCache::PkgIterator Pkg,
  45. pkgCache::VerIterator Ver);
  46. virtual unsigned long Offset() {return iOffset;};
  47. virtual unsigned long Size() {return Section.size();};
  48. virtual bool Step();
  49. bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,FileFd &File,
  50. string section);
  51. static const char *ParseDepends(const char *Start,const char *Stop,
  52. string &Package,string &Ver,unsigned int &Op,
  53. bool const &ParseArchFlags = false,
  54. bool const &StripMultiArch = false);
  55. static const char *ConvertRelation(const char *I,unsigned int &Op);
  56. debListParser(FileFd *File);
  57. };
  58. #endif