]>
Commit | Line | Data |
---|---|---|
7db98ffc MZ |
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 | ||
495e5cb2 | 8 | #include <apt-pkg/hashes.h> |
7db98ffc MZ |
9 | |
10 | #include <map> | |
a75c6a6e | 11 | #include <vector> |
1ddb8596 | 12 | #include <ctime> |
453b82a3 | 13 | #include <string> |
7db98ffc | 14 | |
b9dadc24 DK |
15 | #ifndef APT_8_CLEANER_HEADERS |
16 | #include <apt-pkg/fileutl.h> | |
17 | #endif | |
453b82a3 DK |
18 | #ifndef APT_10_CLEANER_HEADERS |
19 | #include <apt-pkg/pkgcache.h> | |
20 | #endif | |
b9dadc24 | 21 | |
7db98ffc MZ |
22 | class indexRecords |
23 | { | |
3809194b | 24 | APT_HIDDEN bool parseSumData(const char *&Start, const char *End, std::string &Name, |
8f3ba4e8 | 25 | std::string &Hash, unsigned long long &Size); |
7db98ffc MZ |
26 | public: |
27 | struct checkSum; | |
8f3ba4e8 | 28 | std::string ErrorText; |
a2fdb57f MV |
29 | // dpointer (for later9 |
30 | void * d; | |
7db98ffc MZ |
31 | |
32 | protected: | |
8f3ba4e8 DK |
33 | std::string Dist; |
34 | std::string Suite; | |
35 | std::string ExpectedDist; | |
1ddb8596 | 36 | time_t ValidUntil; |
a2fdb57f | 37 | bool SupportsAcquireByHash; |
1ddb8596 | 38 | |
8f3ba4e8 | 39 | std::map<std::string,checkSum *> Entries; |
7db98ffc MZ |
40 | |
41 | public: | |
42 | ||
43 | indexRecords(); | |
8f3ba4e8 | 44 | indexRecords(const std::string ExpectedDist); |
7db98ffc MZ |
45 | |
46 | // Lookup function | |
1dca8dc5 | 47 | virtual checkSum *Lookup(const std::string MetaKey); |
e1430400 | 48 | /** \brief tests if a checksum for this file is available */ |
8f3ba4e8 | 49 | bool Exists(std::string const &MetaKey) const; |
a75c6a6e MZ |
50 | std::vector<std::string> MetaKeys(); |
51 | ||
8f3ba4e8 DK |
52 | virtual bool Load(std::string Filename); |
53 | std::string GetDist() const; | |
7014e148 | 54 | std::string GetSuite() const; |
a2fdb57f | 55 | bool GetSupportsAcquireByHash() const; |
1ddb8596 | 56 | time_t GetValidUntil() const; |
8f3ba4e8 DK |
57 | virtual bool CheckDist(const std::string MaybeDist) const; |
58 | std::string GetExpectedDist() const; | |
862bafea | 59 | virtual ~indexRecords(); |
7db98ffc MZ |
60 | }; |
61 | ||
b3501edb DK |
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 | |
7db98ffc MZ |
67 | struct indexRecords::checkSum |
68 | { | |
8f3ba4e8 | 69 | std::string MetaKeyFilename; |
b3501edb | 70 | HashStringList Hashes; |
650faab0 | 71 | unsigned long long Size; |
b3501edb DK |
72 | |
73 | APT_DEPRECATED HashString Hash; | |
7db98ffc | 74 | }; |
b3501edb DK |
75 | #if __GNUC__ >= 4 |
76 | #pragma GCC diagnostic pop | |
77 | #endif | |
7db98ffc MZ |
78 | |
79 | #endif |