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)  

cachefile.h
Go to the documentation of this file.
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4 
5  CacheFile - Simple wrapper class for opening, generating and whatnot
6 
7  This class implements a simple 2 line mechanism to open various sorts
8  of caches. It can operate as root, as not root, show progress and so on,
9  it transparently handles everything necessary.
10 
11  This means it can rebuild caches from the source list and instantiates
12  and prepares the standard policy mechanism.
13 
14  ##################################################################### */
15  /*}}}*/
16 #ifndef PKGLIB_CACHEFILE_H
17 #define PKGLIB_CACHEFILE_H
18 
19 #include <stddef.h>
20 
21 #include <apt-pkg/depcache.h>
22 #include <apt-pkg/macros.h>
23 #include <apt-pkg/pkgcache.h>
24 
25 
26 class MMap;
27 class pkgPolicy;
28 class pkgSourceList;
29 class pkgIndexFile;
30 class OpProgress;
31 
33 {
34  struct Private;
35  /** \brief dpointer placeholder (for later in case we need it) */
36  Private *const d;
38 
39  protected:
44 
45  public:
47 
48  // We look pretty much exactly like a pointer to a dep cache
49  inline operator pkgCache &() const {return *Cache;};
50  inline operator pkgCache *() const {return Cache;};
51  inline operator pkgDepCache &() const {return *DCache;};
52  inline operator pkgDepCache *() const {return DCache;};
53  inline operator pkgPolicy &() const {return *Policy;};
54  inline operator pkgPolicy *() const {return Policy;};
55  inline operator pkgSourceList &() const {return *SrcList;};
56  inline operator pkgSourceList *() const {return SrcList;};
57  inline pkgDepCache *operator ->() const {return DCache;};
58  inline pkgDepCache &operator *() const {return *DCache;};
59  inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) const {return (*DCache)[I];};
60  inline unsigned char &operator [](pkgCache::DepIterator const &I) const {return (*DCache)[I];};
61 
62  bool BuildCaches(OpProgress *Progress = NULL,bool WithLock = true);
63  bool BuildSourceList(OpProgress *Progress = NULL);
64  bool BuildPolicy(OpProgress *Progress = NULL);
65  bool BuildDepCache(OpProgress *Progress = NULL);
66  bool Open(OpProgress *Progress = NULL, bool WithLock = true);
67  inline bool ReadOnlyOpen(OpProgress *Progress = NULL) { return Open(Progress, false); };
68  static void RemoveCaches();
69  void Close();
70 
71  bool AddIndexFile(pkgIndexFile * const File);
72 
73  inline pkgCache* GetPkgCache() { BuildCaches(NULL, false); return Cache; };
74  inline pkgDepCache* GetDepCache() { BuildDepCache(); return DCache; };
75  inline pkgPolicy* GetPolicy() { BuildPolicy(); return Policy; };
76  inline pkgSourceList* GetSourceList() { BuildSourceList(); return SrcList; };
77 
78  inline bool IsPkgCacheBuilt() const { return (Cache != NULL); };
79  inline bool IsDepCacheBuilt() const { return (DCache != NULL); };
80  inline bool IsPolicyBuilt() const { return (Policy != NULL); };
81  inline bool IsSrcListBuilt() const { return (SrcList != NULL); };
82 
83  pkgCacheFile();
84  explicit pkgCacheFile(pkgDepCache * const Owner);
85  virtual ~~pkgCacheFile();
86 };
87 
88 #endif
static bool std::string const metaIndex const *const pkgAcqMetaClearSig *const pkgAcquire::Item *const I
Definition: mmap.h:41
pkgPolicy * GetPolicy()
Definition: cachefile.h:75
bool ExternOwner
Definition: cachefile.h:37
pkgDepCache * GetDepCache()
Definition: cachefile.h:74
pkgDepCache * DCache
Definition: cachefile.h:42
pkgCache * Cache
Definition: cachefile.h:41
pkgSourceList * GetSourceList()
Definition: cachefile.h:76
MMap * Map
Definition: cachefile.h:40
pkgSourceList * SrcList
Definition: cachefile.h:43
bool IsDepCacheBuilt() const
Definition: cachefile.h:79
bool IsSrcListBuilt() const
Definition: cachefile.h:81
bool IsPkgCacheBuilt() const
Definition: cachefile.h:78
pkgCache * GetPkgCache()
Definition: cachefile.h:73
pkgPolicy * Policy
Definition: cachefile.h:46
bool IsPolicyBuilt() const
Definition: cachefile.h:80
bool ReadOnlyOpen(OpProgress *Progress=NULL)
Definition: cachefile.h:67
Private *const d
dpointer placeholder (for later in case we need it)
Definition: cachefile.h:34
#define APT_PUBLIC
Definition: macros.h:77
pkgCache - Structure definitions for the cache file
bool Policy(CommandLine &CmdL)