]> git.saurik.com Git - apt.git/blob - apt-private/private-cachefile.h
first version with test
[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
7
8 // class CacheFile - Cover class for some dependency cache functions /*{{{*/
9 // ---------------------------------------------------------------------
10 /* */
11 class CacheFile : public pkgCacheFile
12 {
13 static pkgCache *SortCache;
14 static int NameComp(const void *a,const void *b);
15
16 public:
17 pkgCache::Package **List;
18
19 void Sort();
20 bool CheckDeps(bool AllowBroken = false);
21 bool BuildCaches(bool WithLock = true)
22 {
23 OpTextProgress Prog(*_config);
24 if (pkgCacheFile::BuildCaches(&Prog,WithLock) == false)
25 return false;
26 return true;
27 }
28 bool Open(bool WithLock = true)
29 {
30 OpTextProgress Prog(*_config);
31 if (pkgCacheFile::Open(&Prog,WithLock) == false)
32 return false;
33 Sort();
34
35 return true;
36 };
37 bool OpenForInstall()
38 {
39 if (_config->FindB("APT::Get::Print-URIs") == true)
40 return Open(false);
41 else
42 return Open(true);
43 }
44 CacheFile() : List(0) {};
45 ~CacheFile() {
46 delete[] List;
47 }
48 };
49 /*}}}*/
50
51 #endif