indexrecords.h 1.4 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, std::string &Name,
  16. std::string &Hash, unsigned long long &Size);
  17. public:
  18. struct checkSum;
  19. std::string ErrorText;
  20. protected:
  21. std::string Dist;
  22. std::string Suite;
  23. std::string ExpectedDist;
  24. time_t ValidUntil;
  25. std::map<std::string,checkSum *> Entries;
  26. public:
  27. indexRecords();
  28. indexRecords(const std::string ExpectedDist);
  29. // Lookup function
  30. virtual const checkSum *Lookup(const std::string MetaKey);
  31. /** \brief tests if a checksum for this file is available */
  32. bool Exists(std::string const &MetaKey) const;
  33. std::vector<std::string> MetaKeys();
  34. virtual bool Load(std::string Filename);
  35. std::string GetDist() const;
  36. time_t GetValidUntil() const;
  37. virtual bool CheckDist(const std::string MaybeDist) const;
  38. std::string GetExpectedDist() const;
  39. virtual ~indexRecords(){};
  40. };
  41. struct indexRecords::checkSum
  42. {
  43. std::string MetaKeyFilename;
  44. HashString Hash;
  45. unsigned long long Size;
  46. };
  47. #endif