indexfile.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: indexfile.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
  4. /* ######################################################################
  5. Index File - Abstraction for an index of archive/source file.
  6. There are 3 primary sorts of index files, all represented by this
  7. class:
  8. Binary index files
  9. Bianry index files decribing the local system
  10. Source index files
  11. They are all bundled together here, and the interfaces for
  12. sources.list, acquire, cache gen and record parsing all use this class
  13. to acess the underlying representation.
  14. ##################################################################### */
  15. /*}}}*/
  16. #ifndef PKGLIB_INDEXFILE_H
  17. #define PKGLIB_INDEXFILE_H
  18. #ifdef __GNUG__
  19. #pragma interface "apt-pkg/indexfile.h"
  20. #endif
  21. #include <string>
  22. #include <apt-pkg/pkgcache.h>
  23. #include <apt-pkg/srcrecords.h>
  24. #include <apt-pkg/pkgrecords.h>
  25. class pkgAcquire;
  26. class pkgCacheGenerator;
  27. class OpProgress;
  28. class pkgIndexFile
  29. {
  30. public:
  31. class Type
  32. {
  33. public:
  34. // Global list of Items supported
  35. static Type **GlobalList;
  36. static unsigned long GlobalListLen;
  37. static Type *GetType(const char *Type);
  38. const char *Label;
  39. virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const {return 0;};
  40. Type();
  41. };
  42. virtual const Type *GetType() const = 0;
  43. // Return descriptive strings of various sorts
  44. virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
  45. virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
  46. pkgSrcRecords::File const &File) const;
  47. virtual string Describe() const = 0;
  48. // Interface for acquire
  49. virtual string ArchiveURI(string File) const {return string();};
  50. virtual bool GetIndexes(pkgAcquire *Owner) const;
  51. // Interface for the record parsers
  52. virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
  53. // Interface for the Cache Generator
  54. virtual bool Exists() const = 0;
  55. virtual bool HasPackages() const = 0;
  56. virtual unsigned long Size() const = 0;
  57. virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const {return false;};
  58. virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
  59. virtual ~pkgIndexFile() {};
  60. };
  61. #endif