]> git.saurik.com Git - apt.git/blob - apt-private/private-cachefile.h
Merge remote-tracking branch 'upstream/debian/sid' into debian/sid
[apt.git] / apt-private / private-cachefile.h
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>
6 #include <apt-pkg/configuration.h>
7 #include <apt-pkg/pkgcache.h>
8 #include <apt-pkg/macros.h>
9
10
11 // class CacheFile - Cover class for some dependency cache functions /*{{{*/
12 // ---------------------------------------------------------------------
13 /* */
14 class APT_PUBLIC CacheFile : public pkgCacheFile
15 {
16 static pkgCache *SortCache;
17 APT_HIDDEN static int NameComp(const void *a,const void *b) APT_PURE;
18
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