]> git.saurik.com Git - apt.git/blame - apt-private/private-cachefile.h
Japanese manpages translation update
[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
b9179170 12// class CacheFile - Cover class for some dependency cache functions /*{{{*/
63ff4208 13class APT_PUBLIC CacheFile : public pkgCacheFile
b9179170 14{
b9179170 15 public:
a0c19a21
DK
16 std::vector<map_pointer_t> UniverseList;
17
b9179170
MV
18 bool CheckDeps(bool AllowBroken = false);
19 bool BuildCaches(bool WithLock = true)
20 {
21 OpTextProgress Prog(*_config);
22 if (pkgCacheFile::BuildCaches(&Prog,WithLock) == false)
23 return false;
24 return true;
25 }
a0c19a21 26 bool Open(bool WithLock = true)
b9179170
MV
27 {
28 OpTextProgress Prog(*_config);
a0c19a21 29 return pkgCacheFile::Open(&Prog,WithLock);
b9179170
MV
30 };
31 bool OpenForInstall()
32 {
33 if (_config->FindB("APT::Get::Print-URIs") == true)
34 return Open(false);
35 else
36 return Open(true);
37 }
b9179170
MV
38};
39 /*}}}*/
40
9112f777 41class SortedPackageUniverse : public APT::PackageUniverse
a0c19a21
DK
42{
43 std::vector<map_pointer_t> &List;
44 void LazyInit() const;
45
46public:
258b9e51 47 explicit SortedPackageUniverse(CacheFile &Cache);
a0c19a21
DK
48
49 class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, SortedPackageUniverse, SortedPackageUniverse::const_iterator, std::vector<map_pointer_t>::const_iterator, pkgCache::PkgIterator>
50 {
51 pkgCache * const Cache;
3707fd4f
DK
52 public:
53 inline pkgCache::PkgIterator getType(void) const
a0c19a21
DK
54 {
55 if (*_iter == 0) return pkgCache::PkgIterator(*Cache);
56 return pkgCache::PkgIterator(*Cache, Cache->PkgP + *_iter);
57 }
a0c19a21
DK
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) {}
60
61 };
62 typedef const_iterator iterator;
63
9112f777
DK
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()); }
a0c19a21
DK
70};
71
b9179170 72#endif