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