]> git.saurik.com Git - apt.git/blob - apt-pkg/cachefile.h
* debian/rules
[apt.git] / apt-pkg / cachefile.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 // $Id: cachefile.h,v 1.5 2002/04/27 04:28:04 jgg Exp $
4 /* ######################################################################
5
6 CacheFile - Simple wrapper class for opening, generating and whatnot
7
8 This class implements a simple 2 line mechanism to open various sorts
9 of caches. It can operate as root, as not root, show progress and so on,
10 it transparently handles everything necessary.
11
12 This means it can rebuild caches from the source list and instantiates
13 and prepares the standard policy mechanism.
14
15 ##################################################################### */
16 /*}}}*/
17 #ifndef PKGLIB_CACHEFILE_H
18 #define PKGLIB_CACHEFILE_H
19
20
21 #include <apt-pkg/depcache.h>
22
23 class pkgPolicy;
24 class pkgCacheFile
25 {
26 protected:
27
28 MMap *Map;
29 pkgCache *Cache;
30 pkgDepCache *DCache;
31
32 public:
33
34 pkgPolicy *Policy;
35
36 // We look pretty much exactly like a pointer to a dep cache
37 inline operator pkgCache &() {return *Cache;};
38 inline operator pkgCache *() {return Cache;};
39 inline operator pkgDepCache &() {return *DCache;};
40 inline operator pkgDepCache *() {return DCache;};
41 inline pkgDepCache *operator ->() {return DCache;};
42 inline pkgDepCache &operator *() {return *DCache;};
43 inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
44 inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];};
45
46 bool BuildCaches(OpProgress &Progress,bool WithLock = true);
47 bool Open(OpProgress &Progress,bool WithLock = true);
48 void Close();
49
50 pkgCacheFile();
51 ~pkgCacheFile();
52 };
53
54 #endif