indexrecords.h 1.4 KB

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