]> git.saurik.com Git - apt.git/blame - apt-pkg/cachefile.h
* merged with mainline, finalized changelog
[apt.git] / apt-pkg / cachefile.h
CommitLineData
2d11135a
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
0077d829 3// $Id: cachefile.h,v 1.5 2002/04/27 04:28:04 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
b2e465d6
AL
12 This means it can rebuild caches from the source list and instantiates
13 and prepares the standard policy mechanism.
14
2d11135a
AL
15 ##################################################################### */
16 /*}}}*/
17#ifndef PKGLIB_CACHEFILE_H
18#define PKGLIB_CACHEFILE_H
19
20#ifdef __GNUG__
21#pragma interface "apt-pkg/cachefile.h"
22#endif
23
24#include <apt-pkg/depcache.h>
2d11135a 25
b2e465d6 26class pkgPolicy;
2d11135a
AL
27class pkgCacheFile
28{
29 protected:
30
31 MMap *Map;
b2e465d6
AL
32 pkgCache *Cache;
33 pkgDepCache *DCache;
2d11135a
AL
34
35 public:
b2e465d6
AL
36
37 pkgPolicy *Policy;
2d11135a
AL
38
39 // We look pretty much exactly like a pointer to a dep cache
b2e465d6
AL
40 inline operator pkgCache &() {return *Cache;};
41 inline operator pkgCache *() {return Cache;};
42 inline operator pkgDepCache &() {return *DCache;};
43 inline operator pkgDepCache *() {return DCache;};
44 inline pkgDepCache *operator ->() {return DCache;};
45 inline pkgDepCache &operator *() {return *DCache;};
46 inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
47 inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];};
099a4759 48
0077d829 49 bool BuildCaches(OpProgress &Progress,bool WithLock = true);
2d11135a 50 bool Open(OpProgress &Progress,bool WithLock = true);
b2e465d6 51 void Close();
2d11135a
AL
52
53 pkgCacheFile();
54 ~pkgCacheFile();
55};
56
57#endif