debsrcrecords.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: debsrcrecords.h,v 1.8 2004/03/17 05:58:54 mdz Exp $
  4. /* ######################################################################
  5. Debian Source Package Records - Parser implementation for Debian style
  6. source indexes
  7. ##################################################################### */
  8. /*}}}*/
  9. #ifndef PKGLIB_DEBSRCRECORDS_H
  10. #define PKGLIB_DEBSRCRECORDS_H
  11. #include <apt-pkg/srcrecords.h>
  12. #include <apt-pkg/tagfile.h>
  13. #include <apt-pkg/fileutl.h>
  14. #include <stddef.h>
  15. #include <string>
  16. #include <vector>
  17. class pkgIndexFile;
  18. class APT_HIDDEN debSrcRecordParser : public pkgSrcRecords::Parser
  19. {
  20. /** \brief dpointer placeholder (for later in case we need it) */
  21. void * const d;
  22. protected:
  23. FileFd Fd;
  24. pkgTagFile Tags;
  25. pkgTagSection Sect;
  26. std::vector<const char*> StaticBinList;
  27. unsigned long iOffset;
  28. char *Buffer;
  29. public:
  30. virtual bool Restart() APT_OVERRIDE {return Jump(0);};
  31. virtual bool Step() APT_OVERRIDE {iOffset = Tags.Offset(); return Tags.Step(Sect);};
  32. virtual bool Jump(unsigned long const &Off) APT_OVERRIDE {iOffset = Off; return Tags.Jump(Sect,Off);};
  33. virtual std::string Package() const APT_OVERRIDE;
  34. virtual std::string Version() const APT_OVERRIDE {return Sect.FindS("Version");};
  35. virtual std::string Maintainer() const APT_OVERRIDE {return Sect.FindS("Maintainer");};
  36. virtual std::string Section() const APT_OVERRIDE {return Sect.FindS("Section");};
  37. virtual const char **Binaries() APT_OVERRIDE;
  38. virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) APT_OVERRIDE;
  39. virtual unsigned long Offset() APT_OVERRIDE {return iOffset;};
  40. virtual std::string AsStr() APT_OVERRIDE
  41. {
  42. const char *Start=0,*Stop=0;
  43. Sect.GetSection(Start,Stop);
  44. return std::string(Start,Stop);
  45. };
  46. virtual bool Files(std::vector<pkgSrcRecords::File> &F) APT_OVERRIDE;
  47. bool Files2(std::vector<pkgSrcRecords::File2> &F);
  48. debSrcRecordParser(std::string const &File,pkgIndexFile const *Index);
  49. virtual ~debSrcRecordParser();
  50. };
  51. class APT_HIDDEN debDscRecordParser : public debSrcRecordParser
  52. {
  53. public:
  54. debDscRecordParser(std::string const &DscFile, pkgIndexFile const *Index);
  55. };
  56. #endif