indexrecords.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // -*- mode: cpp; mode: fold -*-
  2. // Description /*{{{*/
  3. // $Id: indexrecords.h,v 1.1.2.1 2003/12/24 23:09:17 mdz Exp $
  4. /*}}}*/
  5. #ifndef PKGLIB_INDEXRECORDS_H
  6. #define PKGLIB_INDEXRECORDS_H
  7. #include <apt-pkg/pkgcache.h>
  8. #include <apt-pkg/fileutl.h>
  9. #include <apt-pkg/hashes.h>
  10. #include <map>
  11. #include <vector>
  12. #include <ctime>
  13. class indexRecords
  14. {
  15. bool parseSumData(const char *&Start, const char *End, string &Name,
  16. string &Hash, size_t &Size);
  17. public:
  18. struct checkSum;
  19. string ErrorText;
  20. protected:
  21. string Dist;
  22. string Suite;
  23. string ExpectedDist;
  24. time_t ValidUntil;
  25. std::map<string,checkSum *> Entries;
  26. public:
  27. indexRecords();
  28. indexRecords(const string ExpectedDist);
  29. // Lookup function
  30. virtual const checkSum *Lookup(const string MetaKey);
  31. /** \brief tests if a checksum for this file is available */
  32. bool Exists(string const &MetaKey) const;
  33. std::vector<std::string> MetaKeys();
  34. virtual bool Load(string Filename);
  35. string GetDist() const;
  36. time_t GetValidUntil() const;
  37. virtual bool CheckDist(const string MaybeDist) const;
  38. string GetExpectedDist() const;
  39. virtual ~indexRecords(){};
  40. };
  41. struct indexRecords::checkSum
  42. {
  43. string MetaKeyFilename;
  44. HashString Hash;
  45. size_t Size;
  46. };
  47. #endif