]>
Commit | Line | Data |
---|---|---|
2d11135a AL |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
b826eb9e | 3 | // $Id: cachefile.h,v 1.2 1999/06/12 03:43:48 jgg Exp $ |
2d11135a AL |
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 | ##################################################################### */ | |
13 | /*}}}*/ | |
14 | #ifndef PKGLIB_CACHEFILE_H | |
15 | #define PKGLIB_CACHEFILE_H | |
16 | ||
17 | #ifdef __GNUG__ | |
18 | #pragma interface "apt-pkg/cachefile.h" | |
19 | #endif | |
20 | ||
21 | #include <apt-pkg/depcache.h> | |
22 | #include <apt-pkg/dpkginit.h> | |
23 | ||
24 | class pkgCacheFile | |
25 | { | |
26 | protected: | |
27 | ||
28 | MMap *Map; | |
29 | pkgDepCache *Cache; | |
30 | pkgDpkgLock *Lock; | |
31 | ||
32 | public: | |
33 | ||
34 | // We look pretty much exactly like a pointer to a dep cache | |
35 | inline operator pkgDepCache &() {return *Cache;}; | |
36 | inline pkgDepCache *operator ->() {return Cache;}; | |
37 | inline pkgDepCache &operator *() {return *Cache;}; | |
b826eb9e AL |
38 | inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*Cache)[I];}; |
39 | inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*Cache)[I];}; | |
40 | ||
2d11135a AL |
41 | // Release the dpkg status lock |
42 | inline void ReleaseLock() {Lock->Close();}; | |
43 | ||
44 | bool Open(OpProgress &Progress,bool WithLock = true); | |
45 | ||
46 | pkgCacheFile(); | |
47 | ~pkgCacheFile(); | |
48 | }; | |
49 | ||
50 | #endif |