deblistparser.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. protected:
  24. pkgTagFile Tags;
  25. pkgTagSection Section;
  26. unsigned long iOffset;
  27. string Arch;
  28. std::vector<std::string> Architectures;
  29. bool MultiArchEnabled;
  30. unsigned long UniqFindTagWrite(const char *Tag);
  31. virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
  32. bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
  33. unsigned int Type);
  34. bool ParseProvides(pkgCache::VerIterator &Ver);
  35. bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
  36. static bool GrabWord(string Word,WordList *List,unsigned char &Out);
  37. public:
  38. static unsigned char GetPrio(string Str);
  39. // These all operate against the current section
  40. virtual string Package();
  41. virtual string Architecture();
  42. virtual bool ArchitectureAll();
  43. virtual string Version();
  44. virtual bool NewVersion(pkgCache::VerIterator &Ver);
  45. virtual string Description();
  46. virtual string DescriptionLanguage();
  47. virtual MD5SumValue Description_md5();
  48. virtual unsigned short VersionHash();
  49. virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
  50. pkgCache::VerIterator &Ver);
  51. virtual unsigned long Offset() {return iOffset;};
  52. virtual unsigned long Size() {return Section.size();};
  53. virtual bool Step();
  54. bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
  55. string section);
  56. static const char *ParseDepends(const char *Start,const char *Stop,
  57. string &Package,string &Ver,unsigned int &Op,
  58. bool const &ParseArchFlags = false,
  59. bool const &StripMultiArch = true);
  60. static const char *ConvertRelation(const char *I,unsigned int &Op);
  61. debListParser(FileFd *File, string const &Arch = "");
  62. };
  63. #endif