]> git.saurik.com Git - apt.git/blame - apt-private/private-cachefile.h
eipp: provide the internal planer as an external one
[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>
aaf677da 9#include <apt-pkg/sourcelist.h>
a0c19a21
DK
10#include <apt-pkg/cacheset.h>
11
aaf677da 12#include <apti18n.h>
b9179170 13
b9179170 14// class CacheFile - Cover class for some dependency cache functions /*{{{*/
63ff4208 15class APT_PUBLIC CacheFile : public pkgCacheFile
b9179170 16{
b9179170 17 public:
a0c19a21
DK
18 std::vector<map_pointer_t> UniverseList;
19
b9179170
MV
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 }
a0c19a21 28 bool Open(bool WithLock = true)
b9179170
MV
29 {
30 OpTextProgress Prog(*_config);
a0c19a21 31 return pkgCacheFile::Open(&Prog,WithLock);
b9179170
MV
32 };
33 bool OpenForInstall()
34 {
35 if (_config->FindB("APT::Get::Print-URIs") == true)
36 return Open(false);
37 else
38 return Open(true);
39 }
b9179170
MV
40};
41 /*}}}*/
42
9112f777 43class SortedPackageUniverse : public APT::PackageUniverse
a0c19a21
DK
44{
45 std::vector<map_pointer_t> &List;
46 void LazyInit() const;
47
48public:
258b9e51 49 explicit SortedPackageUniverse(CacheFile &Cache);
a0c19a21
DK
50
51 class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>
52 {
53 pkgCache * const Cache;
3707fd4f
DK
54 public:
55 inline pkgCache::PkgIterator getType(void) const
a0c19a21
DK
56 {
57 if (*_iter == 0) return pkgCache::PkgIterator(*Cache);
58 return pkgCache::PkgIterator(*Cache, Cache->PkgP + *_iter);
59 }
a0c19a21
DK
60 explicit const_iterator(pkgCache * const Owner, std::vector<map_pointer_t>::const_iterator i):
61 Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>(i), Cache(Owner) {}
62
63 };
64 typedef const_iterator iterator;
65
9112f777
DK
66 const_iterator begin() const { LazyInit(); return const_iterator(data(), List.begin()); }
67 const_iterator end() const { LazyInit(); return const_iterator(data(), List.end()); }
68 const_iterator cbegin() const { LazyInit(); return const_iterator(data(), List.begin()); }
69 const_iterator cend() const { LazyInit(); return const_iterator(data(), List.end()); }
70 iterator begin() { LazyInit(); return iterator(data(), List.begin()); }
71 iterator end() { LazyInit(); return iterator(data(), List.end()); }
a0c19a21
DK
72};
73
b9179170 74#endif