indexrecords.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. APT_HIDDEN 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. // dpointer (for later9
  26. void * d;
  27. protected:
  28. std::string Dist;
  29. std::string Suite;
  30. std::string ExpectedDist;
  31. time_t ValidUntil;
  32. bool SupportsAcquireByHash;
  33. std::map<std::string,checkSum *> Entries;
  34. public:
  35. indexRecords();
  36. indexRecords(const std::string ExpectedDist);
  37. // Lookup function
  38. virtual checkSum *Lookup(const std::string MetaKey);
  39. /** \brief tests if a checksum for this file is available */
  40. bool Exists(std::string const &MetaKey) const;
  41. std::vector<std::string> MetaKeys();
  42. virtual bool Load(std::string Filename);
  43. std::string GetDist() const;
  44. std::string GetSuite() const;
  45. bool GetSupportsAcquireByHash() const;
  46. time_t GetValidUntil() const;
  47. virtual bool CheckDist(const std::string MaybeDist) const;
  48. std::string GetExpectedDist() const;
  49. virtual ~indexRecords();
  50. };
  51. #if __GNUC__ >= 4
  52. // ensure that con- & de-structor don't trigger this warning
  53. #pragma GCC diagnostic push
  54. #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
  55. #endif
  56. struct indexRecords::checkSum
  57. {
  58. std::string MetaKeyFilename;
  59. HashStringList Hashes;
  60. unsigned long long Size;
  61. APT_DEPRECATED HashString Hash;
  62. };
  63. #if __GNUC__ >= 4
  64. #pragma GCC diagnostic pop
  65. #endif
  66. #endif