Merge remote-tracking branch 'mvo/debian/sid' into debian/sid
[ntk/apt.git] / apt-private / private-cachefile.h
CommitLineData
b9179170
MV
1#ifndef APT_PRIVATE_CACHEFILE_H
2#define APT_PRIVATE_CACHEFILE_H
3
4#include <apt-pkg/cachefile.h>
5#include <apt-pkg/progress.h>
453b82a3
DK
6#include <apt-pkg/configuration.h>
7#include <apt-pkg/pkgcache.h>
63ff4208 8#include <apt-pkg/macros.h>
b9179170
MV
9
10
11// class CacheFile - Cover class for some dependency cache functions /*{{{*/
12// ---------------------------------------------------------------------
13/* */
63ff4208 14class APT_PUBLIC CacheFile : public pkgCacheFile
b9179170
MV
15{
16 static pkgCache *SortCache;
63ff4208
DK
17 APT_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE;
18
b9179170
MV
19 public:
20 pkgCache::Package **List;
21
22 void Sort();
23 bool CheckDeps(bool AllowBroken = false);
24 bool BuildCaches(bool WithLock = true)
25 {
26 OpTextProgress Prog(*_config);
27 if (pkgCacheFile::BuildCaches(&Prog,WithLock) == false)
28 return false;
29 return true;
30 }
31 bool Open(bool WithLock = true)
32 {
33 OpTextProgress Prog(*_config);
34 if (pkgCacheFile::Open(&Prog,WithLock) == false)
35 return false;
36 Sort();
37
38 return true;
39 };
40 bool OpenForInstall()
41 {
42 if (_config->FindB("APT::Get::Print-URIs") == true)
43 return Open(false);
44 else
45 return Open(true);
46 }
47 CacheFile() : List(0) {};
48 ~CacheFile() {
49 delete[] List;
50 }
51};
52 /*}}}*/
53
54#endif