merged from debian-sid
[ntk/apt.git] / apt-pkg / indexrecords.h
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
8
9 #include <apt-pkg/pkgcache.h>
10 #include <apt-pkg/hashes.h>
11
12 #include <map>
13 #include <vector>
14 #include <ctime>
15
16 #ifndef APT_8_CLEANER_HEADERS
17 #include <apt-pkg/fileutl.h>
18 #endif
19
20 class indexRecords
21 {
22 bool parseSumData(const char *&Start, const char *End, std::string &Name,
23 std::string &Hash, unsigned long long &Size);
24 public:
25 struct checkSum;
26 std::string ErrorText;
27
28 protected:
29 std::string Dist;
30 std::string Suite;
31 std::string ExpectedDist;
32 time_t ValidUntil;
33
34 std::map<std::string,checkSum *> Entries;
35
36 public:
37
38 indexRecords();
39 indexRecords(const std::string ExpectedDist);
40
41 // Lookup function
42 virtual const checkSum *Lookup(const std::string MetaKey);
43 /** \brief tests if a checksum for this file is available */
44 bool Exists(std::string const &MetaKey) const;
45 std::vector<std::string> MetaKeys();
46
47 virtual bool Load(std::string Filename);
48 std::string GetDist() const;
49 time_t GetValidUntil() const;
50 virtual bool CheckDist(const std::string MaybeDist) const;
51 std::string GetExpectedDist() const;
52 virtual ~indexRecords(){};
53 };
54
55 struct indexRecords::checkSum
56 {
57 std::string MetaKeyFilename;
58 HashString Hash;
59 unsigned long long Size;
60 };
61
62 #endif