deblistparser.h 2.4 KB

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