pkgrecords.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: pkgrecords.h,v 1.6 2001/03/13 06:51:46 jgg Exp $
  4. /* ######################################################################
  5. Package Records - Allows access to complete package description records
  6. directly from the file.
  7. The package record system abstracts the actual parsing of the
  8. package files. This is different than the generators parser in that
  9. it is used to access information not generate information. No
  10. information touched by the generator should be parable from here as
  11. it can always be retreived directly from the cache.
  12. ##################################################################### */
  13. /*}}}*/
  14. #ifndef PKGLIB_PKGRECORDS_H
  15. #define PKGLIB_PKGRECORDS_H
  16. #include <apt-pkg/pkgcache.h>
  17. #include <apt-pkg/fileutl.h>
  18. #include <vector>
  19. class pkgRecords /*{{{*/
  20. {
  21. public:
  22. class Parser;
  23. private:
  24. pkgCache &Cache;
  25. std::vector<Parser *>Files;
  26. public:
  27. // Lookup function
  28. Parser &Lookup(pkgCache::VerFileIterator const &Ver);
  29. Parser &Lookup(pkgCache::DescFileIterator const &Desc);
  30. // Construct destruct
  31. pkgRecords(pkgCache &Cache);
  32. ~pkgRecords();
  33. };
  34. /*}}}*/
  35. class pkgRecords::Parser /*{{{*/
  36. {
  37. protected:
  38. virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
  39. virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
  40. public:
  41. friend class pkgRecords;
  42. // These refer to the archive file for the Version
  43. virtual string FileName() {return string();};
  44. virtual string MD5Hash() {return string();};
  45. virtual string SHA1Hash() {return string();};
  46. virtual string SHA256Hash() {return string();};
  47. virtual string SourcePkg() {return string();};
  48. virtual string SourceVer() {return string();};
  49. // These are some general stats about the package
  50. virtual string Maintainer() {return string();};
  51. virtual string ShortDesc() {return string();};
  52. virtual string LongDesc() {return string();};
  53. virtual string Name() {return string();};
  54. virtual string Homepage() {return string();}
  55. // The record in binary form
  56. virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
  57. virtual ~Parser() {};
  58. };
  59. /*}}}*/
  60. #endif