debsrcrecords.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. class debSrcRecordParser : public pkgSrcRecords::Parser
  15. {
  16. /** \brief dpointer placeholder (for later in case we need it) */
  17. void *d;
  18. FileFd Fd;
  19. pkgTagFile Tags;
  20. pkgTagSection Sect;
  21. char *StaticBinList[400];
  22. unsigned long iOffset;
  23. char *Buffer;
  24. unsigned int BufSize;
  25. public:
  26. virtual bool Restart() {return Tags.Jump(Sect,0);};
  27. virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
  28. virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);};
  29. virtual string Package() const {return Sect.FindS("Package");};
  30. virtual string Version() const {return Sect.FindS("Version");};
  31. virtual string Maintainer() const {return Sect.FindS("Maintainer");};
  32. virtual string Section() const {return Sect.FindS("Section");};
  33. virtual const char **Binaries();
  34. virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
  35. virtual unsigned long Offset() {return iOffset;};
  36. virtual string AsStr()
  37. {
  38. const char *Start=0,*Stop=0;
  39. Sect.GetSection(Start,Stop);
  40. return string(Start,Stop);
  41. };
  42. virtual bool Files(vector<pkgSrcRecords::File> &F);
  43. debSrcRecordParser(string const &File,pkgIndexFile const *Index)
  44. : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400),
  45. Buffer(0), BufSize(0) {}
  46. virtual ~debSrcRecordParser();
  47. };
  48. #endif