indexrecords.h 1.3 KB

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