apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

metaindex.h
Go to the documentation of this file.
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 
13 class pkgAcquire;
14 class IndexTarget;
15 class pkgCacheGenerator;
16 class OpProgress;
17 
18 class metaIndexPrivate;
19 
21 {
22 public:
23  struct checkSum
24  {
25  std::string MetaKeyFilename;
27  unsigned long long Size;
28  };
29 
30  enum APT_HIDDEN TriState {
32  };
33 private:
35 protected:
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;
55  std::map<std::string, checkSum *> Entries;
57 
58 public:
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;
89  /** @return a new metaIndex object based on this one, but without information from #Load */
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;
96  /** \brief tests if a checksum for this file is available */
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
Information about an index file.
Definition: indexfile.h:39
Definition: strutl.h:193
std::string ReleaseNotes
Definition: metaindex.h:51
virtual std::vector< IndexTarget > GetIndexTargets() const =0
std::string Suite
Definition: metaindex.h:45
signed short DefaultPin
Definition: metaindex.h:50
std::string Dist
Definition: metaindex.h:40
virtual bool IsTrusted() const =0
TriState Trusted
Definition: metaindex.h:41
virtual metaIndex * UnloadedClone() const =0
virtual std::string ArchiveURI(std::string const &File) const =0
metaIndexPrivate *const d
Definition: metaindex.h:34
std::string Codename
Definition: metaindex.h:46
std::string Version
Definition: metaindex.h:49
std::string Origin
Definition: metaindex.h:47
std::string SignedBy
Definition: metaindex.h:42
virtual std::vector< pkgIndexFile * > * GetIndexFiles()=0
time_t ValidUntil
Definition: metaindex.h:53
virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false)=0
time_t Date
Definition: metaindex.h:52
std::string URI
Definition: metaindex.h:39
virtual time_t GetNotBefore() const =0
std::vector< pkgIndexFile * > * Indexes
Definition: metaindex.h:36
virtual bool Load(std::string const &Filename, std::string *const ErrorText)=0
TriState LoadedSuccessfully
Definition: metaindex.h:56
bool SupportsAcquireByHash
Definition: metaindex.h:54
std::map< std::string, checkSum * > Entries
Definition: metaindex.h:55
std::string Label
Definition: metaindex.h:48
const char * Type
Definition: metaindex.h:38
Represents the process by which a pkgAcquire object should retrieve a file or a collection of files.
Definition: acquire-item.h:59
#define APT_PUBLIC
Definition: macros.h:77
#define APT_HIDDEN
Definition: macros.h:78
TRI_DONTCARE
Definition: metaindex.h:31
TRI_YES
Definition: metaindex.h:31
TRI_NO
Definition: metaindex.h:31
static std::string GetVersion(pkgCacheFile &, pkgCache::VerIterator V)
unsigned long long Size
Definition: metaindex.h:27
HashStringList Hashes
Definition: metaindex.h:26
std::string MetaKeyFilename
Definition: metaindex.h:25