pkgrecords.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: pkgrecords.h,v 1.4 1999/04/07 05:30:17 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. // Header section: pkglib
  15. #ifndef PKGLIB_PKGRECORDS_H
  16. #define PKGLIB_PKGRECORDS_H
  17. #ifdef __GNUG__
  18. #pragma interface "apt-pkg/pkgrecords.h"
  19. #endif
  20. #include <apt-pkg/pkgcache.h>
  21. #include <apt-pkg/fileutl.h>
  22. class pkgRecords
  23. {
  24. public:
  25. class Parser;
  26. private:
  27. pkgCache &Cache;
  28. // List of package files
  29. struct PkgFile
  30. {
  31. FileFd *File;
  32. Parser *Parse;
  33. PkgFile() : File(0), Parse(0) {};
  34. ~PkgFile();
  35. };
  36. PkgFile *Files;
  37. public:
  38. // Lookup function
  39. Parser &Lookup(pkgCache::VerFileIterator const &Ver);
  40. // Construct destruct
  41. pkgRecords(pkgCache &Cache);
  42. ~pkgRecords();
  43. };
  44. class pkgRecords::Parser
  45. {
  46. protected:
  47. virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
  48. public:
  49. friend pkgRecords;
  50. // These refer to the archive file for the Version
  51. virtual string FileName() {return string();};
  52. virtual string MD5Hash() {return string();};
  53. virtual string SourcePkg() {return string();};
  54. // These are some general stats about the package
  55. virtual string Maintainer() {return string();};
  56. virtual string ShortDesc() {return string();};
  57. virtual string LongDesc() {return string();};
  58. virtual ~Parser() {};
  59. };
  60. #endif