deblistparser.h 2.6 KB

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