indexrecords.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 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. #if __GNUC__ >= 4
  48. // ensure that con- & de-structor don't trigger this warning
  49. #pragma GCC diagnostic push
  50. #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  51. #endif
  52. struct indexRecords::checkSum
  53. {
  54. std::string MetaKeyFilename;
  55. HashStringList Hashes;
  56. unsigned long long Size;
  57. APT_DEPRECATED HashString Hash;
  58. };
  59. #if __GNUC__ >= 4
  60. #pragma GCC diagnostic pop
  61. #endif
  62. #endif