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