apt: apt-pkg/metaindex.h Source File

apt 2.3.15 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 };
33private:
34 metaIndexPrivate * const d;
35protected:
36 std::vector <pkgIndexFile *> *Indexes;
37 // parsed from the sources.list
38 const char *Type;
39 std::string URI;
40 std::string Dist;
41 TriState Trusted;
42 std::string SignedBy;
43
44 // parsed from a file
45 std::string Suite;
46 std::string Codename;
47 std::string Origin;
48 std::string Label;
49 std::string Version;
50 signed short DefaultPin;
51 std::string ReleaseNotes;
52 time_t Date;
53 time_t ValidUntil;
54 bool SupportsAcquireByHash;
55 std::map<std::string, checkSum *> Entries;
56 TriState LoadedSuccessfully;
57
58public:
59 // Various accessors
60 std::string GetURI() const;
61 std::string GetDist() const;
62 const char* GetType() const;
63 TriState GetTrusted() const;
64 std::string GetSignedBy() const;
65
66 std::string GetOrigin() const;
67 std::string GetLabel() const;
68 std::string GetVersion() const;
69 std::string GetCodename() const;
70 std::string GetSuite() const;
71 std::string GetReleaseNotes() const;
72 signed short GetDefaultPin() const;
73 bool GetSupportsAcquireByHash() const;
74 time_t GetValidUntil() const;
75 time_t GetDate() const;
76 virtual time_t GetNotBefore() const = 0;
77
78 std::string GetExpectedDist() const;
79 bool CheckDist(std::string const &MaybeDist) const;
80
81 // Interface for acquire
82 virtual std::string Describe() const;
83 virtual std::string ArchiveURI(std::string const& File) const = 0;
84 virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) = 0;
85 virtual std::vector<IndexTarget> GetIndexTargets() const = 0;
86 virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0;
87 virtual bool IsTrusted() const = 0;
88 virtual bool Load(std::string const &Filename, std::string * const ErrorText) = 0;
90 virtual metaIndex * UnloadedClone() const = 0;
91 // the given metaIndex is potentially invalid after this call and should be deleted
92 void swapLoad(metaIndex * const OldMetaIndex);
93
94 // Lookup functions for parsed Hashes
95 checkSum *Lookup(std::string const &MetaKey) const;
97 bool Exists(std::string const &MetaKey) const;
98 std::vector<std::string> MetaKeys() const;
99 TriState GetLoadedSuccessfully() const;
100
101 // Interfaces for pkgCacheGen
102 virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const;
103 virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
104
105
106 metaIndex(std::string const &URI, std::string const &Dist,
107 char const * const Type);
108 virtual ~metaIndex();
109
110 virtual bool IsArchitectureSupported(std::string const &arch) const;
111 virtual bool IsArchitectureAllSupportedFor(IndexTarget const &target) const;
112 virtual bool HasSupportForComponent(std::string const &component) const;
113};
114
115#endif
HashStringList
Definition: hashes.h:65
Hashes
Definition: hashes.h:170
IndexTarget
Information about an index file.
Definition: indexfile.h:39
OpProgress
Definition: progress.h:30
URI
Definition: strutl.h:208
metaIndexPrivate
Definition: metaindex.cc:13
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:48
metaIndex::checkSum
Definition: metaindex.h:24