indexrecords.h 1.5 KB

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