summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheiterators.h
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2005-10-17 14:20:25 +0000
committerMichael Vogt <mvo@debian.org>2005-10-17 14:20:25 +0000
commitc511502fcec38680fff2f27aec75908e348e5905 (patch)
tree113bdb52474c1111110da47939342c9fd2994f1a /apt-pkg/cacheiterators.h
parent3226f06e15d6c9816c26e87bb58f5589b84a467b (diff)
parent422eeaaadf17904bf2f08cdf9e8998bec645097c (diff)
* merged ddtp support
Patches applied: * michael.vogt@ubuntu.com--2005/apt--ddtp--0--base-0 tag of otavio@debian.org--2005/apt--ddtp--0.6--patch-14 * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-1 * fixed a problem when it comes to the cache rebuilding * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-2 * try harder to get the correct language code * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-3 * fix for output of the description and the debTranslationsIndex::Exists() * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-4 * made the translation downloading work * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-5 * FindInCache() uses the correct file now * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-6 * don't throw any more warnings * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-7 * merged with otavoi * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-8 * merged with otavios branch * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-9 * code cleanups (thanks matt!), moved UsePackage before the description list build in pkgcachegen to catch MMap errors early * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-10 * added a BUGS file with known problem, added apt-cdrom support for translated package descriptions * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-11 * updated with mainline * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-12 * added README.ddtp * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-13 * merged with apt--mvo * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-14 * added DDTP::URL-Remap. KILL THIS FEATURE once ddtp support is offical * michael.vogt@ubuntu.com--2005/apt--ddtp--0--patch-15 * remvoed the remap feature again, dosn't work anyway * otavio@debian.org--2005/apt--ddtp--0.6--base-0 tag of apt@packages.debian.org/apt--main--0--patch-71 * otavio@debian.org--2005/apt--ddtp--0.6--patch-1 Port DDTP to APT 0.6 branch * otavio@debian.org--2005/apt--ddtp--0.6--patch-2 Fix sintax error on apt-cache * otavio@debian.org--2005/apt--ddtp--0.6--patch-3 Remove a unused var. * otavio@debian.org--2005/apt--ddtp--0.6--patch-4 Fix problems due APT and structural changes. * otavio@debian.org--2005/apt--ddtp--0.6--patch-5 Fix problems due APT and structural changes. * otavio@debian.org--2005/apt--ddtp--0.6--patch-6 Sync with apt@packages.debian.org/apt--main--0--patch-74 * otavio@debian.org--2005/apt--ddtp--0.6--patch-7 Sync with apt@packages.debian.org/apt--main--0--patch-75 * otavio@debian.org--2005/apt--ddtp--0.6--patch-8 Sync with apt--main--0--patch-76 * otavio@debian.org--2005/apt--ddtp--0.6--patch-9 Remote a changelog entry added by mistake while merging. * otavio@debian.org--2005/apt--ddtp--0.6--patch-10 Sync with apt--main--0--patch-78 * otavio@debian.org--2005/apt--ddtp--0.6--patch-11 Revert fixes changes to move these to apt--fixes--0 branch. * otavio@debian.org--2005/apt--ddtp--0.6--patch-12 Another fix included here by mistake. Moving it to apt--fixes--0 branch. * otavio@debian.org--2005/apt--ddtp--0.6--patch-13 Merge last changes from apt--main--0. * otavio@debian.org--2005/apt--ddtp--0.6--patch-14 Add FindInCache method to skip the rebuild of cache every time. * otavio@debian.org--2005/apt--ddtp--0.6--patch-15 Merge changes did by Michael Vogt to solve some rebuilding mistakes. * otavio@debian.org--2005/apt--ddtp--0.6--patch-16 Does't show Description twice * otavio@debian.org--2005/apt--ddtp--0.6--patch-17 Merge last fixes did by Michael but preserve my version of apt-cache.cc fix. * otavio@debian.org--2005/apt--ddtp--0.6--patch-18 Revert changes did by mistake on translation files. * otavio@debian.org--2005/apt--ddtp--0.6--patch-19 Merge last changes did from upstream side. * otavio@debian.org--2005/apt--ddtp--0.6--patch-20 Sync with apt--main--0--patch-87
Diffstat (limited to 'apt-pkg/cacheiterators.h')
-rw-r--r--apt-pkg/cacheiterators.h83
1 files changed, 82 insertions, 1 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index c3a0d0a5a..f0aafb52d 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -99,7 +99,7 @@ class pkgCache::VerIterator
{
Version *Ver;
pkgCache *Owner;
-
+
void _dummy();
public:
@@ -128,6 +128,7 @@ class pkgCache::VerIterator
inline const char *Section() const {return Ver->Section == 0?0:Owner->StrP + Ver->Section;};
inline const char *Arch() const {return Ver->Arch == 0?0:Owner->StrP + Ver->Arch;};
inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Ver->ParentPkg);};
+ inline DescIterator DescriptionList() const;
inline DepIterator DependsList() const;
inline PrvIterator ProvidesList() const;
inline VerFileIterator FileList() const;
@@ -148,6 +149,50 @@ class pkgCache::VerIterator
};
};
+// Description Iterator
+class pkgCache::DescIterator
+{
+ Description *Desc;
+ pkgCache *Owner;
+
+ void _dummy();
+
+ public:
+
+ // Iteration
+ void operator ++(int) {if (Desc != Owner->DescP) Desc = Owner->DescP + Desc->NextDesc;};
+ inline void operator ++() {operator ++(0);};
+ inline bool end() const {return Desc == Owner->DescP?true:false;};
+ inline void operator =(const DescIterator &B) {Desc = B.Desc; Owner = B.Owner;};
+
+ // Comparison
+ inline bool operator ==(const DescIterator &B) const {return Desc == B.Desc;};
+ inline bool operator !=(const DescIterator &B) const {return Desc != B.Desc;};
+ int CompareDesc(const DescIterator &B) const;
+
+ // Accessors
+ inline Description *operator ->() {return Desc;};
+ inline Description const *operator ->() const {return Desc;};
+ inline Description &operator *() {return *Desc;};
+ inline Description const &operator *() const {return *Desc;};
+ inline operator Description *() {return Desc == Owner->DescP?0:Desc;};
+ inline operator Description const *() const {return Desc == Owner->DescP?0:Desc;};
+ inline pkgCache *Cache() {return Owner;};
+
+ inline const char *LanguageCode() const {return Owner->StrP + Desc->language_code;};
+ inline const char *md5() const {return Owner->StrP + Desc->md5sum;};
+ inline DescFileIterator FileList() const;
+ inline unsigned long Index() const {return Desc - Owner->DescP;};
+
+ inline DescIterator() : Desc(0), Owner(0) {};
+ inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Desc(Trg),
+ Owner(&Owner)
+ {
+ if (Desc == 0)
+ Desc = Owner.DescP;
+ };
+};
+
// Dependency iterator
class pkgCache::DepIterator
{
@@ -338,6 +383,38 @@ class pkgCache::VerFileIterator
inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {};
};
+// Description File
+class pkgCache::DescFileIterator
+{
+ pkgCache *Owner;
+ DescFile *FileP;
+
+ public:
+
+ // Iteration
+ void operator ++(int) {if (FileP != Owner->DescFileP) FileP = Owner->DescFileP + FileP->NextFile;};
+ inline void operator ++() {operator ++(0);};
+ inline bool end() const {return FileP == Owner->DescFileP?true:false;};
+
+ // Comparison
+ inline bool operator ==(const DescFileIterator &B) const {return FileP == B.FileP;};
+ inline bool operator !=(const DescFileIterator &B) const {return FileP != B.FileP;};
+
+ // Accessors
+ inline DescFile *operator ->() {return FileP;};
+ inline DescFile const *operator ->() const {return FileP;};
+ inline DescFile const &operator *() const {return *FileP;};
+ inline operator DescFile *() {return FileP == Owner->DescFileP?0:FileP;};
+ inline operator DescFile const *() const {return FileP == Owner->DescFileP?0:FileP;};
+ inline pkgCache *Cache() {return Owner;};
+
+ inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP->File + Owner->PkgFileP);};
+ inline unsigned long Index() const {return FileP - Owner->DescFileP;};
+
+ inline DescFileIterator() : Owner(0), FileP(0) {};
+ inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), FileP(Trg) {};
+};
+
// Inlined Begin functions cant be in the class because of order problems
inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
{return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);};
@@ -347,11 +424,15 @@ inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const
{return DepIterator(*Owner,Owner->DepP + Pkg->RevDepends,Pkg);};
inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const
{return PrvIterator(*Owner,Owner->ProvideP + Pkg->ProvidesList,Pkg);};
+inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const
+ {return DescIterator(*Owner,Owner->DescP + Ver->DescriptionList);};
inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const
{return PrvIterator(*Owner,Owner->ProvideP + Ver->ProvidesList,Ver);};
inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const
{return DepIterator(*Owner,Owner->DepP + Ver->DependsList,Ver);};
inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
{return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);};
+inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
+ {return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);};
#endif