]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/cachefile.h
* doc/examples/configure-index:
[apt.git] / apt-pkg / cachefile.h
... / ...
CommitLineData
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#ifdef __GNUG__
21#pragma interface "apt-pkg/cachefile.h"
22#endif
23
24#include <apt-pkg/depcache.h>
25#include <apt-pkg/acquire.h>
26#include <apt-pkg/sourcelist.h>
27
28class pkgPolicy;
29class pkgCacheFile
30{
31 protected:
32
33 MMap *Map;
34 pkgCache *Cache;
35 pkgDepCache *DCache;
36
37 public:
38
39 pkgPolicy *Policy;
40
41 // We look pretty much exactly like a pointer to a dep cache
42 inline operator pkgCache &() {return *Cache;};
43 inline operator pkgCache *() {return Cache;};
44 inline operator pkgDepCache &() {return *DCache;};
45 inline operator pkgDepCache *() {return DCache;};
46 inline pkgDepCache *operator ->() {return DCache;};
47 inline pkgDepCache &operator *() {return *DCache;};
48 inline pkgDepCache::StateCache &operator [](pkgCache::PkgIterator const &I) {return (*DCache)[I];};
49 inline unsigned char &operator [](pkgCache::DepIterator const &I) {return (*DCache)[I];};
50
51 bool BuildCaches(OpProgress &Progress,bool WithLock = true);
52 bool Open(OpProgress &Progress,bool WithLock = true);
53 bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List);
54 void Close();
55
56 pkgCacheFile();
57 ~pkgCacheFile();
58};
59
60#endif