]> git.saurik.com Git - apt.git/blob - apt-pkg/indexrecords.h
add shared code into pkgAcqMetaSigBase::GenerateAuthWarning()
[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 // dpointer (for later9
30 void * d;
31
32 protected:
33 std::string Dist;
34 std::string Suite;
35 std::string ExpectedDist;
36 time_t ValidUntil;
37 bool SupportsAcquireByHash;
38
39 std::map<std::string,checkSum *> Entries;
40
41 public:
42
43 indexRecords();
44 indexRecords(const std::string ExpectedDist);
45
46 // Lookup function
47 virtual checkSum *Lookup(const std::string MetaKey);
48 /** \brief tests if a checksum for this file is available */
49 bool Exists(std::string const &MetaKey) const;
50 std::vector<std::string> MetaKeys();
51
52 virtual bool Load(std::string Filename);
53 std::string GetDist() const;
54 std::string GetSuite() const;
55 bool GetSupportsAcquireByHash() const;
56 time_t GetValidUntil() const;
57 virtual bool CheckDist(const std::string MaybeDist) const;
58 std::string GetExpectedDist() const;
59 virtual ~indexRecords(){};
60 };
61
62 #if __GNUC__ >= 4
63 // ensure that con- & de-structor don't trigger this warning
64 #pragma GCC diagnostic push
65 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
66 #endif
67 struct indexRecords::checkSum
68 {
69 std::string MetaKeyFilename;
70 HashStringList Hashes;
71 unsigned long long Size;
72
73 APT_DEPRECATED HashString Hash;
74 };
75 #if __GNUC__ >= 4
76 #pragma GCC diagnostic pop
77 #endif
78
79 #endif