indexrecords.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. std::string GetSuite() const;
  39. time_t GetValidUntil() const;
  40. virtual bool CheckDist(const std::string MaybeDist) const;
  41. std::string GetExpectedDist() const;
  42. virtual ~indexRecords(){};
  43. };
  44. struct indexRecords::checkSum
  45. {
  46. std::string MetaKeyFilename;
  47. HashString Hash;
  48. unsigned long long Size;
  49. };
  50. #endif