pkgrecords.h 2.1 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. #ifdef __GNUG__
  17. #pragma interface "apt-pkg/pkgrecords.h"
  18. #endif
  19. #include <apt-pkg/pkgcache.h>
  20. #include <apt-pkg/fileutl.h>
  21. #include <vector>
  22. class pkgRecords
  23. {
  24. public:
  25. class Parser;
  26. private:
  27. pkgCache &Cache;
  28. std::vector<Parser *>Files;
  29. public:
  30. // Lookup function
  31. Parser &Lookup(pkgCache::VerFileIterator const &Ver);
  32. Parser &Lookup(pkgCache::DescFileIterator const &Desc);
  33. // Construct destruct
  34. pkgRecords(pkgCache &Cache);
  35. ~pkgRecords();
  36. };
  37. class pkgRecords::Parser
  38. {
  39. protected:
  40. virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
  41. virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
  42. public:
  43. friend class pkgRecords;
  44. // These refer to the archive file for the Version
  45. virtual string FileName() {return string();};
  46. virtual string MD5Hash() {return string();};
  47. virtual string SHA1Hash() {return string();};
  48. virtual string SourcePkg() {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. // The record in binary form
  55. virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
  56. virtual ~Parser() {};
  57. };
  58. #endif