apt: apt-pkg/metaindex.h Source File

apt 2.7.6 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 <stddef.h>
8
9#include <string>
10#include <vector>
11
12
13class pkgAcquire;
14class IndexTarget;
15class pkgCacheGenerator;
16class OpProgress;
17
18class metaIndexPrivate;
19
20 class APT_PUBLIC metaIndex
21{
22public:
23 struct checkSum
24 {
25 std::string MetaKeyFilename;
26 HashStringList Hashes;
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;
100 virtual metaIndex * UnloadedClone() const = 0;
101 // the given metaIndex is potentially invalid after this call and should be deleted
102 void swapLoad(metaIndex * const OldMetaIndex);
103
104 // Lookup functions for parsed Hashes
105 checkSum *Lookup(std::string const &MetaKey) const;
107 bool Exists(std::string const &MetaKey) const;
108 std::vector<std::string> MetaKeys() const;
109 TriState GetLoadedSuccessfully() const;
110
111 // Interfaces for pkgCacheGen
112 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
113 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
114
115
116 metaIndex(std::string const &URI, std::string const &Dist,
117 char const * const Type);
118 virtual ~metaIndex();
119
120 virtual bool IsArchitectureSupported(std::string const &arch) const;
121 virtual bool IsArchitectureAllSupportedFor(IndexTarget const &target) const;
122 virtual bool HasSupportForComponent(std::string const &component) const;
123};
124
125#endif
HashStringList
Definition hashes.h:79
Hashes
Definition hashes.h:184
IndexTarget
Information about an index file.
Definition indexfile.h:39
OpProgress
Definition progress.h:30
URI
Definition strutl.h:212
metaIndex
Definition metaindex.h:21
metaIndex::UnloadedClone
virtual metaIndex * UnloadedClone() const =0
pkgAcquire
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition acquire-item.h:59
pkgCacheGenerator
Definition pkgcachegen.h:43
pkgCache
Definition cacheiterators.h:47
metaIndexPrivate
Definition metaindex.cc:15
metaIndex::checkSum
Definition metaindex.h:24