apt 3.0.3
commandline package manager
metaindex.h
1#ifndef PKGLIB_METAINDEX_H
2#define PKGLIB_METAINDEX_H
3
4#include <apt-pkg/indexfile.h>
5#include <apt-pkg/init.h>
6
7#include <cstddef>
8
9#include <string>
10#include <vector>
11
12
13class pkgAcquire;
14class IndexTarget;
16class OpProgress;
17
19
20class APT_PUBLIC metaIndex
21{
22public:
23 struct checkSum
24 {
25 std::string MetaKeyFilename;
27 unsigned long long Size;
28 };
29
30 enum APT_HIDDEN TriState {
31 TRI_YES, TRI_DONTCARE, TRI_NO, TRI_UNSET
32 };
33
34 enum class APT_HIDDEN Flag
35 {
36 DEB822 = 0x01,
37 };
38
39 private:
40 metaIndexPrivate * const d;
41protected:
42 std::vector <pkgIndexFile *> *Indexes;
43 // parsed from the sources.list
44 const char *Type;
45 std::string URI;
46 std::string Dist;
47 TriState Trusted;
48 std::string SignedBy;
49
50 // parsed from a file
51 std::string Suite;
52 std::string Codename;
53 std::string Origin;
54 std::string Label;
55 std::string Version;
56 signed short DefaultPin;
57 std::string ReleaseNotes;
58 time_t Date;
59 time_t ValidUntil;
60 bool SupportsAcquireByHash;
61 std::map<std::string, checkSum *> Entries;
62 TriState LoadedSuccessfully;
63
64public:
65 // Various accessors
66 std::string GetURI() const;
67 std::string GetDist() const;
68 const char* GetType() const;
69 TriState GetTrusted() const;
70 std::string GetSignedBy() const;
71
72 std::string GetOrigin() const;
73 std::string GetLabel() const;
74 std::string GetVersion() const;
75 std::string GetCodename() const;
76 std::string GetSuite() const;
77 std::string GetReleaseNotes() const;
78 signed short GetDefaultPin() const;
79 bool GetSupportsAcquireByHash() const;
80 time_t GetValidUntil() const;
81 time_t GetDate() const;
82 virtual time_t GetNotBefore() const = 0;
83#ifdef APT_COMPILING_APT
84 bool HasFlag(Flag flag) const;
85#endif
86 void SetFlag(Flag flag) APT_HIDDEN;
87
88 std::string GetExpectedDist() const;
89 bool CheckDist(std::string const &MaybeDist) const;
90
91 // Interface for acquire
92 virtual std::string Describe() const;
93 virtual std::string ArchiveURI(std::string const& File) const = 0;
94 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) = 0;
95 virtual std::vector<IndexTarget> GetIndexTargets() const = 0;
96 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
97 virtual bool IsTrusted() const = 0;
98 virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0;
99 bool Load(std::string *const ErrorText);
101 virtual metaIndex * UnloadedClone() const = 0;
102 // the given metaIndex is potentially invalid after this call and should be deleted
103 void swapLoad(metaIndex * const OldMetaIndex);
104
105 // Lookup functions for parsed Hashes
106 checkSum *Lookup(std::string const &MetaKey) const;
108 bool Exists(std::string const &MetaKey) const;
109 std::vector<std::string> MetaKeys() const;
110 TriState GetLoadedSuccessfully() const;
111
112 // Interfaces for pkgCacheGen
113 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
114 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
115
116
117 metaIndex(std::string const &URI, std::string const &Dist,
118 char const * const Type);
119 virtual ~metaIndex();
120
121 virtual bool IsArchitectureSupported(std::string const &arch) const;
122 virtual bool IsArchitectureAllSupportedFor(IndexTarget const &target) const;
123 virtual bool HasSupportForComponent(std::string const &component) const;
124
125#ifdef APT_COMPILING_APT
126 bool IsTrustedSet() { return Trusted == TRI_YES; }
127#endif
128};
129
130#endif
Definition hashes.h:79
Definition hashes.h:184
Information about an index file.
Definition indexfile.h:39
Definition progress.h:30
Definition strutl.h:220
Definition metaindex.h:21
virtual metaIndex * UnloadedClone() const =0
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition acquire-item.h:59
Definition pkgcachegen.h:43
Definition cacheiterators.h:47
Definition metaindex.cc:16
Definition metaindex.h:24