srcrecords.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: srcrecords.h,v 1.1 1999/04/04 01:17:29 jgg Exp $
  4. /* ######################################################################
  5. Source Package Records - Allows access to source package records
  6. Parses and allows access to the list of source records and searching by
  7. source name on that list.
  8. ##################################################################### */
  9. /*}}}*/
  10. #ifndef PKGLIB_SRCRECORDS_H
  11. #define PKGLIB_SRCRECORDS_H
  12. #ifdef __GNUG__
  13. #pragma interface "apt-pkg/srcrecords.h"
  14. #endif
  15. #include <apt-pkg/fileutl.h>
  16. #include <apt-pkg/sourcelist.h>
  17. class pkgSrcRecords
  18. {
  19. public:
  20. class Parser
  21. {
  22. FileFd *File;
  23. public:
  24. virtual bool Restart() = 0;
  25. virtual bool Step() = 0;
  26. virtual bool Jump(unsigned long Off) = 0;
  27. virtual unsigned long Offset() = 0;
  28. virtual string Package() = 0;
  29. virtual string Version() = 0;
  30. virtual string Maintainer() = 0;
  31. virtual string Section() = 0;
  32. virtual const char **Binaries() = 0;
  33. Parser(FileFd *File) : File(File) {};
  34. virtual ~Parser() {delete File;};
  35. };
  36. private:
  37. // The list of files and the current parser pointer
  38. Parser **Files;
  39. Parser **Current;
  40. public:
  41. // Reset the search
  42. bool Restart();
  43. // Locate a package by name
  44. Parser *Find(const char *Package,bool SrcOnly = false);
  45. pkgSrcRecords(pkgSourceList &List);
  46. ~pkgSrcRecords();
  47. };
  48. #endif