]> git.saurik.com Git - apt.git/blame - apt-pkg/metaindex.h
releasing 1.1~exp14
[apt.git] / apt-pkg / metaindex.h
CommitLineData
b3d44315
MV
1#ifndef PKGLIB_METAINDEX_H
2#define PKGLIB_METAINDEX_H
3
b3d44315 4#include <apt-pkg/indexfile.h>
7014e148 5#include <apt-pkg/init.h>
b3d44315 6
453b82a3
DK
7#include <stddef.h>
8
9#include <string>
10#include <vector>
11
12#ifndef APT_10_CLEANER_HEADERS
13#include <apt-pkg/pkgcache.h>
14class pkgCacheGenerator;
15class OpProgress;
16#endif
a4f6bdc8 17#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
18#include <apt-pkg/srcrecords.h>
19#include <apt-pkg/pkgrecords.h>
a4f6bdc8
DK
20using std::string;
21#endif
22
b3d44315 23class pkgAcquire;
261727f0 24class IndexTarget;
b07aeb1a
DK
25class pkgCacheGenerator;
26class OpProgress;
b3d44315
MV
27
28class metaIndex
29{
5ad0096a
DK
30public:
31 APT_IGNORE_DEPRECATED_PUSH
32 struct checkSum
33 {
34 std::string MetaKeyFilename;
35 HashStringList Hashes;
36 unsigned long long Size;
37
38 APT_DEPRECATED HashString Hash;
39 };
40 APT_IGNORE_DEPRECATED_POP
41
42 enum APT_HIDDEN TriState {
43 TRI_YES, TRI_DONTCARE, TRI_NO, TRI_UNSET
44 };
45private:
6c55f07a 46 void * const d;
5ad0096a 47protected:
8f3ba4e8 48 std::vector <pkgIndexFile *> *Indexes;
5ad0096a 49 // parsed from the sources.list
b3d44315 50 const char *Type;
8f3ba4e8
DK
51 std::string URI;
52 std::string Dist;
5ad0096a 53 TriState Trusted;
b0d40854 54 std::string SignedBy;
b3d44315 55
5ad0096a
DK
56 // parsed from a file
57 std::string Suite;
58 std::string Codename;
59 time_t Date;
60 time_t ValidUntil;
61 bool SupportsAcquireByHash;
62 std::map<std::string, checkSum *> Entries;
b0d40854 63 TriState LoadedSuccessfully;
b3d44315 64
5ad0096a 65public:
b3d44315 66 // Various accessors
5ad0096a
DK
67 std::string GetURI() const;
68 std::string GetDist() const;
69 const char* GetType() const;
70 TriState GetTrusted() const;
b0d40854 71 std::string GetSignedBy() const;
b3d44315 72
5ad0096a
DK
73 std::string GetCodename() const;
74 std::string GetSuite() const;
75 bool GetSupportsAcquireByHash() const;
76 time_t GetValidUntil() const;
77 time_t GetDate() const;
78
79 std::string GetExpectedDist() const;
80 bool CheckDist(std::string const &MaybeDist) const;
7014e148 81
b3d44315 82 // Interface for acquire
5ad0096a 83 virtual std::string Describe() const;
7014e148 84 virtual std::string ArchiveURI(std::string const& File) const = 0;
5ad0096a 85 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) = 0;
261727f0 86 virtual std::vector<IndexTarget> GetIndexTargets() const = 0;
f105aaba 87 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
b3d44315 88 virtual bool IsTrusted() const = 0;
5ad0096a
DK
89 virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0;
90 /** @return a new metaIndex object based on this one, but without information from #Load */
91 virtual metaIndex * UnloadedClone() const = 0;
92 // the given metaIndex is potentially invalid after this call and should be deleted
93 void swapLoad(metaIndex * const OldMetaIndex);
b3d44315 94
5ad0096a
DK
95 // Lookup functions for parsed Hashes
96 checkSum *Lookup(std::string const &MetaKey) const;
97 /** \brief tests if a checksum for this file is available */
98 bool Exists(std::string const &MetaKey) const;
99 std::vector<std::string> MetaKeys() const;
100 TriState GetLoadedSuccessfully() const;
101
102 // Interfaces for pkgCacheGen
3fd89e62 103 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
b07aeb1a
DK
104 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
105
5ad0096a 106
f105aaba
DK
107 metaIndex(std::string const &URI, std::string const &Dist,
108 char const * const Type);
109 virtual ~metaIndex();
b3d44315
MV
110};
111
112#endif