You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

96 lines
3.1 KiB

  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. #ifndef APT_8_CLEANER_HEADERS
  14. #include <apt-pkg/indexfile.h>
  15. #endif
  16. class debListParser : public pkgCacheGenerator::ListParser
  17. {
  18. public:
  19. // Parser Helper
  20. struct WordList
  21. {
  22. const char *Str;
  23. unsigned char Val;
  24. };
  25. private:
  26. /** \brief dpointer placeholder (for later in case we need it) */
  27. void *d;
  28. protected:
  29. pkgTagFile Tags;
  30. pkgTagSection Section;
  31. unsigned long iOffset;
  32. std::string Arch;
  33. std::vector<std::string> Architectures;
  34. bool MultiArchEnabled;
  35. unsigned long UniqFindTagWrite(const char *Tag);
  36. virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
  37. bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
  38. unsigned int Type);
  39. bool ParseProvides(pkgCache::VerIterator &Ver);
  40. bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version);
  41. static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
  42. public:
  43. static unsigned char GetPrio(std::string Str);
  44. // These all operate against the current section
  45. virtual std::string Package();
  46. virtual std::string Architecture();
  47. virtual bool ArchitectureAll();
  48. virtual std::string Version();
  49. virtual bool NewVersion(pkgCache::VerIterator &Ver);
  50. virtual std::string Description();
  51. virtual std::string DescriptionLanguage();
  52. virtual MD5SumValue Description_md5();
  53. virtual unsigned short VersionHash();
  54. virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
  55. pkgCache::VerIterator &Ver);
  56. virtual unsigned long Offset() {return iOffset;};
  57. virtual unsigned long Size() {return Section.size();};
  58. virtual bool Step();
  59. bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
  60. std::string section);
  61. static const char *ParseDepends(const char *Start,const char *Stop,
  62. std::string &Package,std::string &Ver,unsigned int &Op);
  63. static const char *ParseDepends(const char *Start,const char *Stop,
  64. std::string &Package,std::string &Ver,unsigned int &Op,
  65. bool const &ParseArchFlags);
  66. static const char *ParseDepends(const char *Start,const char *Stop,
  67. std::string &Package,std::string &Ver,unsigned int &Op,
  68. bool const &ParseArchFlags, bool const &StripMultiArch);
  69. static const char *ParseDepends(const char *Start,const char *Stop,
  70. std::string &Package,std::string &Ver,unsigned int &Op,
  71. bool const &ParseArchFlags, bool const &StripMultiArch,
  72. bool const &ParseRestrictionsList);
  73. static const char *ConvertRelation(const char *I,unsigned int &Op);
  74. debListParser(FileFd *File, std::string const &Arch = "");
  75. virtual ~debListParser() {};
  76. };
  77. #endif