]> git.saurik.com Git - apt.git/blame - apt-pkg/indexrecords.h
make all d-pointer * const pointers
[apt.git] / apt-pkg / indexrecords.h
CommitLineData
7db98ffc 1// -*- mode: cpp; mode: fold -*-
7db98ffc
MZ
2#ifndef PKGLIB_INDEXRECORDS_H
3#define PKGLIB_INDEXRECORDS_H
4
495e5cb2 5#include <apt-pkg/hashes.h>
7db98ffc
MZ
6
7#include <map>
a75c6a6e 8#include <vector>
1ddb8596 9#include <ctime>
453b82a3 10#include <string>
7db98ffc 11
b9dadc24
DK
12#ifndef APT_8_CLEANER_HEADERS
13#include <apt-pkg/fileutl.h>
14#endif
453b82a3
DK
15#ifndef APT_10_CLEANER_HEADERS
16#include <apt-pkg/pkgcache.h>
17#endif
b9dadc24 18
7db98ffc
MZ
19class indexRecords
20{
3809194b 21 APT_HIDDEN bool parseSumData(const char *&Start, const char *End, std::string &Name,
8f3ba4e8 22 std::string &Hash, unsigned long long &Size);
7db98ffc
MZ
23 public:
24 struct checkSum;
8f3ba4e8 25 std::string ErrorText;
07cb47e7
DK
26
27 private:
28 enum APT_HIDDEN { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
29 // dpointer (for later)
6c55f07a 30 void * const d;
07cb47e7 31
7db98ffc 32 protected:
8f3ba4e8
DK
33 std::string Dist;
34 std::string Suite;
35 std::string ExpectedDist;
6bf93605 36 time_t Date;
1ddb8596 37 time_t ValidUntil;
a2fdb57f 38 bool SupportsAcquireByHash;
1ddb8596 39
8f3ba4e8 40 std::map<std::string,checkSum *> Entries;
7db98ffc
MZ
41
42 public:
e8afd168 43 explicit indexRecords(const std::string &ExpectedDist = "");
7db98ffc
MZ
44
45 // Lookup function
e8afd168 46 virtual checkSum *Lookup(std::string const &MetaKey);
e1430400 47 /** \brief tests if a checksum for this file is available */
8f3ba4e8 48 bool Exists(std::string const &MetaKey) const;
a75c6a6e
MZ
49 std::vector<std::string> MetaKeys();
50
e8afd168
DK
51 virtual bool Load(std::string const &Filename);
52 virtual bool CheckDist(std::string const &MaybeDist) const;
07cb47e7 53
8f3ba4e8 54 std::string GetDist() const;
7014e148 55 std::string GetSuite() const;
a2fdb57f 56 bool GetSupportsAcquireByHash() const;
1ddb8596 57 time_t GetValidUntil() const;
6bf93605 58 time_t GetDate() const;
8f3ba4e8 59 std::string GetExpectedDist() const;
07cb47e7
DK
60
61 /** \brief check if source is marked as always trusted */
62 bool IsAlwaysTrusted() const;
63 /** \brief check if source is marked as never trusted */
64 bool IsNeverTrusted() const;
65
66 /** \brief sets an explicit trust value
67 *
68 * \b true means that the source should always be considered trusted,
69 * while \b false marks a source as always untrusted, even if we have
70 * a valid signature and everything.
71 */
72 void SetTrusted(bool const Trusted);
73
862bafea 74 virtual ~indexRecords();
7db98ffc
MZ
75};
76
586d8704 77APT_IGNORE_DEPRECATED_PUSH
7db98ffc
MZ
78struct indexRecords::checkSum
79{
8f3ba4e8 80 std::string MetaKeyFilename;
b3501edb 81 HashStringList Hashes;
650faab0 82 unsigned long long Size;
b3501edb
DK
83
84 APT_DEPRECATED HashString Hash;
7db98ffc 85};
586d8704 86APT_IGNORE_DEPRECATED_POP
7db98ffc
MZ
87
88#endif