indexrecords.h 1.2 KB

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