debrecords.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: debrecords.h,v 1.8 2001/03/13 06:51:46 jgg Exp $
  4. /* ######################################################################
  5. Debian Package Records - Parser for debian package records
  6. This provides display-type parsing for the Packages file. This is
  7. different than the the list parser which provides cache generation
  8. services. There should be no overlap between these two.
  9. ##################################################################### */
  10. /*}}}*/
  11. #ifndef PKGLIB_DEBRECORDS_H
  12. #define PKGLIB_DEBRECORDS_H
  13. #include <apt-pkg/pkgrecords.h>
  14. #include <apt-pkg/tagfile.h>
  15. #include <apt-pkg/fileutl.h>
  16. #include <apt-pkg/pkgcache.h>
  17. #include <string>
  18. #ifndef APT_8_CLEANER_HEADERS
  19. #include <apt-pkg/indexfile.h>
  20. #endif
  21. class debRecordParser : public pkgRecords::Parser
  22. {
  23. /** \brief dpointer placeholder (for later in case we need it) */
  24. void *d;
  25. protected:
  26. FileFd File;
  27. pkgTagFile Tags;
  28. pkgTagSection Section;
  29. virtual bool Jump(pkgCache::VerFileIterator const &Ver);
  30. virtual bool Jump(pkgCache::DescFileIterator const &Desc);
  31. public:
  32. // These refer to the archive file for the Version
  33. virtual std::string FileName();
  34. virtual std::string MD5Hash();
  35. virtual std::string SHA1Hash();
  36. virtual std::string SHA256Hash();
  37. virtual std::string SHA512Hash();
  38. virtual std::string SourcePkg();
  39. virtual std::string SourceVer();
  40. // These are some general stats about the package
  41. virtual std::string Maintainer();
  42. virtual std::string ShortDesc();
  43. virtual std::string LongDesc();
  44. virtual std::string Name();
  45. virtual std::string Homepage();
  46. // An arbitrary custom field
  47. virtual std::string RecordField(const char *fieldName);
  48. virtual void GetRec(const char *&Start,const char *&Stop);
  49. debRecordParser(std::string FileName,pkgCache &Cache);
  50. virtual ~debRecordParser() {};
  51. };
  52. // custom record parser that reads deb files directly
  53. class debDebFileRecordParser : public debRecordParser
  54. {
  55. public:
  56. virtual std::string FileName() {
  57. return File.Name();
  58. }
  59. debDebFileRecordParser(std::string FileName,pkgCache &Cache)
  60. : debRecordParser(FileName, Cache) {};
  61. };
  62. #endif