1 #ifndef APT_PRIVATE_CACHEFILE_H
2 #define APT_PRIVATE_CACHEFILE_H
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 #include <apt-pkg/sourcelist.h>
10 #include <apt-pkg/cacheset.h>
12 // class CacheFile - Cover class for some dependency cache functions /*{{{*/
13 class APT_PUBLIC CacheFile
: public pkgCacheFile
16 std::vector
<map_pointer_t
> UniverseList
;
18 bool CheckDeps(bool AllowBroken
= false);
19 bool BuildCaches(bool WithLock
= true)
21 OpTextProgress
Prog(*_config
);
22 if (pkgCacheFile::BuildCaches(&Prog
,WithLock
) == false)
26 bool Open(bool WithLock
= true)
28 OpTextProgress
Prog(*_config
);
29 return pkgCacheFile::Open(&Prog
,WithLock
);
33 if (_config
->FindB("APT::Get::Print-URIs") == true)
41 class SortedPackageUniverse
: public APT::PackageUniverse
43 std::vector
<map_pointer_t
> &List
;
44 void LazyInit() const;
47 explicit SortedPackageUniverse(CacheFile
&Cache
);
49 class const_iterator
: public APT::Container_iterator_base
<APT::PackageContainerInterface
, SortedPackageUniverse
, SortedPackageUniverse::const_iterator
, std::vector
<map_pointer_t
>::const_iterator
, pkgCache::PkgIterator
>
51 pkgCache
* const Cache
;
53 inline pkgCache::PkgIterator
getType(void) const
55 if (*_iter
== 0) return pkgCache::PkgIterator(*Cache
);
56 return pkgCache::PkgIterator(*Cache
, Cache
->PkgP
+ *_iter
);
58 explicit const_iterator(pkgCache
* const Owner
, std::vector
<map_pointer_t
>::const_iterator i
):
59 Container_iterator_base
<APT::PackageContainerInterface
, SortedPackageUniverse
, SortedPackageUniverse::const_iterator
, std::vector
<map_pointer_t
>::const_iterator
, pkgCache::PkgIterator
>(i
), Cache(Owner
) {}
62 typedef const_iterator iterator
;
64 const_iterator
begin() const { LazyInit(); return const_iterator(data(), List
.begin()); }
65 const_iterator
end() const { LazyInit(); return const_iterator(data(), List
.end()); }
66 const_iterator
cbegin() const { LazyInit(); return const_iterator(data(), List
.begin()); }
67 const_iterator
cend() const { LazyInit(); return const_iterator(data(), List
.end()); }
68 iterator
begin() { LazyInit(); return iterator(data(), List
.begin()); }
69 iterator
end() { LazyInit(); return iterator(data(), List
.end()); }