deblistparser.h 2.6 KB

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