pkgrecords.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. class pkgRecords
  22. {
  23. public:
  24. class Parser;
  25. private:
  26. pkgCache &Cache;
  27. Parser **Files;
  28. public:
  29. // Lookup function
  30. Parser &Lookup(pkgCache::VerFileIterator const &Ver);
  31. Parser &Lookup(pkgCache::DescFileIterator const &Desc);
  32. // Construct destruct
  33. pkgRecords(pkgCache &Cache);
  34. ~pkgRecords();
  35. };
  36. class pkgRecords::Parser
  37. {
  38. protected:
  39. virtual bool Jump(pkgCache::VerFileIterator const &Ver) = 0;
  40. virtual bool Jump(pkgCache::DescFileIterator const &Desc) = 0;
  41. public:
  42. friend class pkgRecords;
  43. // These refer to the archive file for the Version
  44. virtual string FileName() {return string();};
  45. virtual string MD5Hash() {return string();};
  46. virtual string SHA1Hash() {return string();};
  47. virtual string SourcePkg() {return string();};
  48. // These are some general stats about the package
  49. virtual string Maintainer() {return string();};
  50. virtual string ShortDesc() {return string();};
  51. virtual string LongDesc() {return string();};
  52. virtual string Name() {return string();};
  53. // The record in binary form
  54. virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
  55. virtual ~Parser() {};
  56. };
  57. #endif