apt: apt-pkg/cacheiterators.h Source File

apt 2.3.15 commandline package manager

cacheiterators.h
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3/* ######################################################################
4
5 Cache Iterators - Iterators for navigating the cache structure
6
7 The iterators all provides ++,==,!=,->,* and end for their type.
8 The end function can be used to tell if the list has been fully
9 traversed.
10
11 Unlike STL iterators these contain helper functions to access the data
12 that is being iterated over. This is because the data structures can't
13 be formed in a manner that is intuitive to use and also mmapable.
14
15 For each variable in the target structure that would need a translation
16 to be accessed correctly a translating function of the same name is
17 present in the iterator. If applicable the translating function will
18 return an iterator.
19
20 The DepIterator can iterate over two lists, a list of 'version depends'
21 or a list of 'package reverse depends'. The type is determined by the
22 structure passed to the constructor, which should be the structure
23 that has the depends pointer as a member. The provide iterator has the
24 same system.
25
26 This header is not user includable, please use apt-pkg/pkgcache.h
27
28 ##################################################################### */
29 /*}}}*/
30#ifndef PKGLIB_CACHEITERATORS_H
31#define PKGLIB_CACHEITERATORS_H
32#ifndef __PKGLIB_IN_PKGCACHE_H
33#warning apt-pkg/cacheiterators.h should not be included directly, include apt-pkg/pkgcache.h instead
34#endif
35#include <apt-pkg/macros.h>
36
37#include <iosfwd>
38#include <iterator>
39#include <string>
40#include <apt-pkg/string_view.h>
41
42#include <string.h>
43
44// abstract Iterator template /*{{{*/
45/* This template provides the very basic iterator methods we
46 need to have for doing some walk-over-the-cache magic */
47 template<typename Str, typename Itr> class APT_PUBLIC pkgCache::Iterator :
48 public std::iterator<std::forward_iterator_tag, Str> {
57 Str* OwnerPointer() const { return static_cast<Itr const*>(this)->OwnerPointer(); }
58
59 protected:
60 Str *S;
61 pkgCache *Owner;
62
63 public:
64 // Iteration
65 inline bool end() const {return Owner == 0 || S == OwnerPointer();}
66
67 // Comparison
68 inline bool operator ==(const Itr &B) const {return S == B.S;}
69 inline bool operator !=(const Itr &B) const {return S != B.S;}
70
71 // Accessors
72 inline Str *operator ->() {return S;}
73 inline Str const *operator ->() const {return S;}
74 inline operator Str *() {return S == OwnerPointer() ? 0 : S;}
75 inline operator Str const *() const {return S == OwnerPointer() ? 0 : S;}
76 inline Str &operator *() {return *S;}
77 inline Str const &operator *() const {return *S;}
78 inline pkgCache *Cache() const {return Owner;}
79
80 // Mixed stuff
81 inline bool IsGood() const { return S && Owner && ! end();}
82 inline unsigned long Index() const {return S - OwnerPointer();}
83 inline map_pointer<Str> MapPointer() const {return map_pointer<Str>(Index()) ;}
84
85 void ReMap(void const * const oldMap, void * const newMap) {
86 if (Owner == 0 || S == 0)
87 return;
88 S = static_cast<Str *>(newMap) + (S - static_cast<Str const *>(oldMap));
89 }
90
91 // Constructors - look out for the variable assigning
92 inline Iterator() : S(0), Owner(0) {}
93 inline Iterator(pkgCache &Owner,Str *T = 0) : S(T), Owner(&Owner) {}
94};
95 /*}}}*/
96// Group Iterator /*{{{*/
97/* Packages with the same name are collected in a Group so someone only
98 interest in package names can iterate easily over the names, so the
99 different architectures can be treated as of the "same" package
100 (apt internally treat them as totally different packages) */
101class APT_PUBLIC pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
102 long HashIndex;
103
104 public:
105 inline Group* OwnerPointer() const {
106 return (Owner != 0) ? Owner->GrpP : 0;
107 }
108
109 // This constructor is the 'begin' constructor, never use it.
110 explicit inline GrpIterator(pkgCache &Owner) : Iterator<Group, GrpIterator>(Owner), HashIndex(-1) {
111 S = OwnerPointer();
112 operator++();
113 }
114
115 GrpIterator& operator++();
116 inline GrpIterator operator++(int) { GrpIterator const tmp(*this); operator++(); return tmp; }
117
118 inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
119 inline PkgIterator PackageList() const;
120 inline VerIterator VersionsInSource() const;
121 PkgIterator FindPkg(APT::StringView Arch = APT::StringView("any", 3)) const;
129 PkgIterator FindPreferredPkg(bool const &PreferNonVirtual = true) const;
130 PkgIterator NextPkg(PkgIterator const &Pkg) const;
131
132 // Constructors
133 inline GrpIterator(pkgCache &Owner, Group *Trg) : Iterator<Group, GrpIterator>(Owner, Trg), HashIndex(0) {
134 if (S == 0)
135 S = OwnerPointer();
136 }
137 inline GrpIterator() : Iterator<Group, GrpIterator>(), HashIndex(0) {}
138
139};
140 /*}}}*/
141// Package Iterator /*{{{*/
142class APT_PUBLIC pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
143 long HashIndex;
144
145 public:
146 inline Package* OwnerPointer() const {
147 return (Owner != 0) ? Owner->PkgP : 0;
148 }
149
150 // This constructor is the 'begin' constructor, never use it.
151 explicit inline PkgIterator(pkgCache &Owner) : Iterator<Package, PkgIterator>(Owner), HashIndex(-1) {
152 S = OwnerPointer();
153 operator++();
154 }
155
156 PkgIterator& operator++();
157 inline PkgIterator operator++(int) { PkgIterator const tmp(*this); operator++(); return tmp; }
158
159 enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure};
160
161 // Accessors
162 inline const char *Name() const { return Group().Name(); }
163 inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge ||
164 (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);}
165 inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;}
166 inline APT_PURE GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);}
167
168 inline VerIterator VersionList() const APT_PURE;
169 inline VerIterator CurrentVer() const APT_PURE;
170 inline DepIterator RevDependsList() const APT_PURE;
171 inline PrvIterator ProvidesList() const APT_PURE;
172 OkState State() const APT_PURE;
173 const char *CurVersion() const APT_PURE;
174
175 //Nice printable representation
176 APT_DEPRECATED_MSG("Use APT::PrettyPkg instead") friend std::ostream& operator <<(std::ostream& out, PkgIterator i);
177 std::string FullName(bool const &Pretty = false) const;
178
179 // Constructors
180 inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator<Package, PkgIterator>(Owner, Trg), HashIndex(0) {
181 if (S == 0)
182 S = OwnerPointer();
183 }
184 inline PkgIterator() : Iterator<Package, PkgIterator>(), HashIndex(0) {}
185};
186 /*}}}*/
187// Version Iterator /*{{{*/
188class APT_PUBLIC pkgCache::VerIterator : public Iterator<Version, VerIterator> {
189 public:
190 inline Version* OwnerPointer() const {
191 return (Owner != 0) ? Owner->VerP : 0;
192 }
193
194 // Iteration
195 inline VerIterator& operator++() {if (S != Owner->VerP) S = Owner->VerP + S->NextVer; return *this;}
196 inline VerIterator operator++(int) { VerIterator const tmp(*this); operator++(); return tmp; }
197
198 inline VerIterator NextInSource()
199 {
200 if (S != Owner->VerP)
201 S = Owner->VerP + S->NextInSource;
202 return *this;
203 }
204
205 // Comparison
206 int CompareVer(const VerIterator &B) const;
211 inline bool SimilarVer(const VerIterator &B) const {
212 return (B.end() == false && S->Hash == B->Hash && strcmp(VerStr(), B.VerStr()) == 0);
213 }
214
215 // Accessors
216 inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}
217 inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}
220 inline const char *SourcePkgName() const {return Owner->StrP + S->SourcePkgName;}
223 inline const char *SourceVerStr() const {return Owner->StrP + S->SourceVerStr;}
224 inline const char *Arch() const {
225 if ((S->MultiArch & pkgCache::Version::All) == pkgCache::Version::All)
226 return "all";
227 return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
228 }
229 inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}
230
231 inline DescIterator DescriptionList() const;
232 DescIterator TranslatedDescriptionForLanguage(APT::StringView lang) const;
233 DescIterator TranslatedDescription() const;
234 inline DepIterator DependsList() const;
235 inline PrvIterator ProvidesList() const;
236 inline VerFileIterator FileList() const;
237 bool Downloadable() const;
238 inline const char *PriorityType() const {return Owner->Priority(S->Priority);}
239 const char *MultiArchType() const APT_PURE;
240 std::string RelStr() const;
241
242 bool Automatic() const;
243 VerFileIterator NewestFile() const;
244
245#ifdef APT_COMPILING_APT
246 inline unsigned int PhasedUpdatePercentage() const
247 {
248 return (static_cast<Version::Extra *>(Owner->Map.Data()) + S->d)->PhasedUpdatePercentage;
249 }
250 inline bool PhasedUpdatePercentage(unsigned int percentage)
251 {
252 if (percentage > 100)
253 return false;
254 (static_cast<Version::Extra *>(Owner->Map.Data()) + S->d)->PhasedUpdatePercentage = static_cast<uint8_t>(percentage);
255 return true;
256 }
257#endif
258
259 inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Iterator<Version, VerIterator>(Owner, Trg) {
260 if (S == 0)
261 S = OwnerPointer();
262 }
263 inline VerIterator() : Iterator<Version, VerIterator>() {}
264};
265 /*}}}*/
266// Description Iterator /*{{{*/
267class APT_PUBLIC pkgCache::DescIterator : public Iterator<Description, DescIterator> {
268 public:
269 inline Description* OwnerPointer() const {
270 return (Owner != 0) ? Owner->DescP : 0;
271 }
272
273 // Iteration
274 inline DescIterator& operator++() {if (S != Owner->DescP) S = Owner->DescP + S->NextDesc; return *this;}
275 inline DescIterator operator++(int) { DescIterator const tmp(*this); operator++(); return tmp; }
276
277 // Comparison
278 int CompareDesc(const DescIterator &B) const;
279
280 // Accessors
281 inline const char *LanguageCode() const {return Owner->StrP + S->language_code;}
282 inline const char *md5() const {return Owner->StrP + S->md5sum;}
283 inline DescFileIterator FileList() const;
284
285 inline DescIterator() : Iterator<Description, DescIterator>() {}
286 inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Iterator<Description, DescIterator>(Owner, Trg) {
287 if (S == 0)
288 S = Owner.DescP;
289 }
290};
291 /*}}}*/
292// Dependency iterator /*{{{*/
293class APT_PUBLIC pkgCache::DepIterator : public Iterator<Dependency, DepIterator> {
294 enum {DepVer, DepRev} Type;
295 DependencyData * S2;
296
297 public:
298 inline Dependency* OwnerPointer() const {
299 return (Owner != 0) ? Owner->DepP : 0;
300 }
301
302 // Iteration
303 DepIterator& operator++();
304 inline DepIterator operator++(int) { DepIterator const tmp(*this); operator++(); return tmp; }
305
306 // Accessors
307 inline const char *TargetVer() const {return S2->Version == 0?0:Owner->StrP + S2->Version;}
308 inline PkgIterator TargetPkg() const {return PkgIterator(*Owner,Owner->PkgP + S2->Package);}
309 inline PkgIterator SmartTargetPkg() const {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;}
310 inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);}
311 inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[uint32_t(S->ParentVer)].ParentPkg);}
312 inline bool Reverse() const {return Type == DepRev;}
313 bool IsCritical() const APT_PURE;
314 bool IsNegative() const APT_PURE;
315 bool IsIgnorable(PrvIterator const &Prv) const APT_PURE;
316 bool IsIgnorable(PkgIterator const &Pkg) const APT_PURE;
317 /* MultiArch can be translated to SingleArch for an resolver and we did so,
318 by adding dependencies to help the resolver understand the problem, but
319 sometimes it is needed to identify these to ignore them… */
320 inline bool IsMultiArchImplicit() const APT_PURE {
321 return (S2->CompareOp & pkgCache::Dep::MultiArchImplicit) == pkgCache::Dep::MultiArchImplicit;
322 }
323 /* This covers additionally negative dependencies, which aren't arch-specific,
324 but change architecture nonetheless as a Conflicts: foo does applies for all archs */
325 bool IsImplicit() const APT_PURE;
326
327 bool IsSatisfied(VerIterator const &Ver) const APT_PURE;
328 bool IsSatisfied(PrvIterator const &Prv) const APT_PURE;
329 void GlobOr(DepIterator &Start,DepIterator &End);
330 Version **AllTargets() const;
331 bool SmartTargetPkg(PkgIterator &Result) const;
332 inline const char *CompType() const {return Owner->CompType(S2->CompareOp);}
333 inline const char *DepType() const {return Owner->DepType(S2->Type);}
334
335 // overrides because we are special
336 struct DependencyProxy
337 {
338 map_stringitem_t &Version;
339 map_pointer<pkgCache::Package> &Package;
340 map_id_t &ID;
341 unsigned char &Type;
342 unsigned char &CompareOp;
343 map_pointer<pkgCache::Version> &ParentVer;
344 map_pointer<pkgCache::DependencyData> &DependencyData;
345 map_pointer<Dependency> &NextRevDepends;
346 map_pointer<Dependency> &NextDepends;
347 map_pointer<pkgCache::DependencyData> &NextData;
348 DependencyProxy const * operator->() const { return this; }
349 DependencyProxy * operator->() { return this; }
350 };
351 inline DependencyProxy operator->() const {return (DependencyProxy) { S2->Version, S2->Package, S->ID, S2->Type, S2->CompareOp, S->ParentVer, S->DependencyData, S->NextRevDepends, S->NextDepends, S2->NextData };}
352 inline DependencyProxy operator->() {return (DependencyProxy) { S2->Version, S2->Package, S->ID, S2->Type, S2->CompareOp, S->ParentVer, S->DependencyData, S->NextRevDepends, S->NextDepends, S2->NextData };}
353 void ReMap(void const * const oldMap, void * const newMap)
354 {
355 Iterator<Dependency, DepIterator>::ReMap(oldMap, newMap);
356 if (Owner == 0 || S == 0 || S2 == 0)
357 return;
358 S2 = static_cast<DependencyData *>(newMap) + (S2 - static_cast<DependencyData const *>(oldMap));
359 }
360
361 //Nice printable representation
362 APT_DEPRECATED_MSG("Use APT::PrettyDep instead") friend std::ostream& operator <<(std::ostream& out, DepIterator D);
363
364 inline DepIterator(pkgCache &Owner, Dependency *Trg, Version* = 0) :
365 Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepVer), S2(Trg == 0 ? Owner.DepDataP : (Owner.DepDataP + Trg->DependencyData)) {
366 if (S == 0)
367 S = Owner.DepP;
368 }
369 inline DepIterator(pkgCache &Owner, Dependency *Trg, Package*) :
370 Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepRev), S2(Trg == 0 ? Owner.DepDataP : (Owner.DepDataP + Trg->DependencyData)) {
371 if (S == 0)
372 S = Owner.DepP;
373 }
374 inline DepIterator() : Iterator<Dependency, DepIterator>(), Type(DepVer), S2(0) {}
375};
376 /*}}}*/
377// Provides iterator /*{{{*/
378class APT_PUBLIC pkgCache::PrvIterator : public Iterator<Provides, PrvIterator> {
379 enum {PrvVer, PrvPkg} Type;
380
381 public:
382 inline Provides* OwnerPointer() const {
383 return (Owner != 0) ? Owner->ProvideP : 0;
384 }
385
386 // Iteration
387 inline PrvIterator& operator ++() {if (S != Owner->ProvideP) S = Owner->ProvideP +
388 (Type == PrvVer?S->NextPkgProv:S->NextProvides); return *this;}
389 inline PrvIterator operator++(int) { PrvIterator const tmp(*this); operator++(); return tmp; }
390
391 // Accessors
392 inline const char *Name() const {return ParentPkg().Name();}
393 inline const char *ProvideVersion() const {return S->ProvideVersion == 0?0:Owner->StrP + S->ProvideVersion;}
394 inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + S->ParentPkg);}
395 inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);}
396 inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[uint32_t(S->Version)].ParentPkg);}
397
398 /* MultiArch can be translated to SingleArch for an resolver and we did so,
399 by adding provides to help the resolver understand the problem, but
400 sometimes it is needed to identify these to ignore them… */
401 bool IsMultiArchImplicit() const APT_PURE
402 { return (S->Flags & pkgCache::Flag::MultiArchImplicit) == pkgCache::Flag::MultiArchImplicit; }
403
404
405 inline PrvIterator() : Iterator<Provides, PrvIterator>(), Type(PrvVer) {}
406 inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) :
407 Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvVer) {
408 if (S == 0)
409 S = Owner.ProvideP;
410 }
411 inline PrvIterator(pkgCache &Owner, Provides *Trg, Package*) :
412 Iterator<Provides, PrvIterator>(Owner, Trg), Type(PrvPkg) {
413 if (S == 0)
414 S = Owner.ProvideP;
415 }
416};
417 /*}}}*/
418// Release file /*{{{*/
419class APT_PUBLIC pkgCache::RlsFileIterator : public Iterator<ReleaseFile, RlsFileIterator> {
420 public:
421 inline ReleaseFile* OwnerPointer() const {
422 return (Owner != 0) ? Owner->RlsFileP : 0;
423 }
424
425 // Iteration
426 inline RlsFileIterator& operator++() {if (S != Owner->RlsFileP) S = Owner->RlsFileP + S->NextFile;return *this;}
427 inline RlsFileIterator operator++(int) { RlsFileIterator const tmp(*this); operator++(); return tmp; }
428
429 // Accessors
430 inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
431 inline const char *Archive() const {return S->Archive == 0?0:Owner->StrP + S->Archive;}
432 inline const char *Version() const {return S->Version == 0?0:Owner->StrP + S->Version;}
433 inline const char *Origin() const {return S->Origin == 0?0:Owner->StrP + S->Origin;}
434 inline const char *Codename() const {return S->Codename ==0?0:Owner->StrP + S->Codename;}
435 inline const char *Label() const {return S->Label == 0?0:Owner->StrP + S->Label;}
436 inline const char *Site() const {return S->Site == 0?0:Owner->StrP + S->Site;}
437 inline bool Flagged(pkgCache::Flag::ReleaseFileFlags const flag) const {return (S->Flags & flag) == flag; }
438
439 std::string RelStr();
440
441 // Constructors
442 inline RlsFileIterator() : Iterator<ReleaseFile, RlsFileIterator>() {}
443 explicit inline RlsFileIterator(pkgCache &Owner) : Iterator<ReleaseFile, RlsFileIterator>(Owner, Owner.RlsFileP) {}
444 inline RlsFileIterator(pkgCache &Owner,ReleaseFile *Trg) : Iterator<ReleaseFile, RlsFileIterator>(Owner, Trg) {}
445};
446 /*}}}*/
447// Package file /*{{{*/
448class APT_PUBLIC pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator> {
449 public:
450 inline PackageFile* OwnerPointer() const {
451 return (Owner != 0) ? Owner->PkgFileP : 0;
452 }
453
454 // Iteration
455 inline PkgFileIterator& operator++() {if (S != Owner->PkgFileP) S = Owner->PkgFileP + S->NextFile; return *this;}
456 inline PkgFileIterator operator++(int) { PkgFileIterator const tmp(*this); operator++(); return tmp; }
457
458 // Accessors
459 inline const char *FileName() const {return S->FileName == 0?0:Owner->StrP + S->FileName;}
460 inline pkgCache::RlsFileIterator ReleaseFile() const {return RlsFileIterator(*Owner, Owner->RlsFileP + S->Release);}
461 inline const char *Archive() const {return S->Release == 0 ? Component() : ReleaseFile().Archive();}
462 inline const char *Version() const {return S->Release == 0 ? NULL : ReleaseFile().Version();}
463 inline const char *Origin() const {return S->Release == 0 ? NULL : ReleaseFile().Origin();}
464 inline const char *Codename() const {return S->Release == 0 ? NULL : ReleaseFile().Codename();}
465 inline const char *Label() const {return S->Release == 0 ? NULL : ReleaseFile().Label();}
466 inline const char *Site() const {return S->Release == 0 ? NULL : ReleaseFile().Site();}
467 inline bool Flagged(pkgCache::Flag::ReleaseFileFlags const flag) const {return S->Release== 0 ? false : ReleaseFile().Flagged(flag);}
468 inline bool Flagged(pkgCache::Flag::PkgFFlags const flag) const {return (S->Flags & flag) == flag;}
469 inline const char *Component() const {return S->Component == 0?0:Owner->StrP + S->Component;}
470 inline const char *Architecture() const {return S->Architecture == 0?0:Owner->StrP + S->Architecture;}
471 inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;}
472
473 std::string RelStr();
474
475 // Constructors
476 inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {}
477 explicit inline PkgFileIterator(pkgCache &Owner) : Iterator<PackageFile, PkgFileIterator>(Owner, Owner.PkgFileP) {}
478 inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Iterator<PackageFile, PkgFileIterator>(Owner, Trg) {}
479};
480 /*}}}*/
481// Version File /*{{{*/
482class APT_PUBLIC pkgCache::VerFileIterator : public pkgCache::Iterator<VerFile, VerFileIterator> {
483 public:
484 inline VerFile* OwnerPointer() const {
485 return (Owner != 0) ? Owner->VerFileP : 0;
486 }
487
488 // Iteration
489 inline VerFileIterator& operator++() {if (S != Owner->VerFileP) S = Owner->VerFileP + S->NextFile; return *this;}
490 inline VerFileIterator operator++(int) { VerFileIterator const tmp(*this); operator++(); return tmp; }
491
492 // Accessors
493 inline PkgFileIterator File() const {return PkgFileIterator(*Owner, Owner->PkgFileP + S->File);}
494
495 inline VerFileIterator() : Iterator<VerFile, VerFileIterator>() {}
496 inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Iterator<VerFile, VerFileIterator>(Owner, Trg) {}
497};
498 /*}}}*/
499// Description File /*{{{*/
500class APT_PUBLIC pkgCache::DescFileIterator : public Iterator<DescFile, DescFileIterator> {
501 public:
502 inline DescFile* OwnerPointer() const {
503 return (Owner != 0) ? Owner->DescFileP : 0;
504 }
505
506 // Iteration
507 inline DescFileIterator& operator++() {if (S != Owner->DescFileP) S = Owner->DescFileP + S->NextFile; return *this;}
508 inline DescFileIterator operator++(int) { DescFileIterator const tmp(*this); operator++(); return tmp; }
509
510 // Accessors
511 inline PkgFileIterator File() const {return PkgFileIterator(*Owner, Owner->PkgFileP + S->File);}
512
513 inline DescFileIterator() : Iterator<DescFile, DescFileIterator>() {}
514 inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Iterator<DescFile, DescFileIterator>(Owner, Trg) {}
515};
516 /*}}}*/
517// Inlined Begin functions can't be in the class because of order problems /*{{{*/
518inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const
519 {return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}
520 inline pkgCache::VerIterator pkgCache::GrpIterator::VersionsInSource() const
521 {
522 return VerIterator(*Owner, Owner->VerP + S->VersionsInSource);
523 }
524inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
525 {return VerIterator(*Owner,Owner->VerP + S->VersionList);}
526inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const
527 {return VerIterator(*Owner,Owner->VerP + S->CurrentVer);}
528inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const
529 {return DepIterator(*Owner,Owner->DepP + S->RevDepends,S);}
530inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const
531 {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}
532inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const
533 {return DescIterator(*Owner,Owner->DescP + S->DescriptionList);}
534inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const
535 {return PrvIterator(*Owner,Owner->ProvideP + S->ProvidesList,S);}
536inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const
537 {return DepIterator(*Owner,Owner->DepP + S->DependsList,S);}
538inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
539 {return VerFileIterator(*Owner,Owner->VerFileP + S->FileList);}
540inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
541 {return DescFileIterator(*Owner,Owner->DescFileP + S->FileList);}
542 /*}}}*/
543#endif
APT::StringView
Simple subset of std::string_view from C++17.
Definition: string_view.h:27
map_pointer
Definition: pkgcache.h:98
pkgCache::Iterator
Definition: pkgcache.h:144
pkgCache
Definition: cacheiterators.h:48
pkgCache::SimilarVer
bool SimilarVer(const VerIterator &B) const
compares two version and returns if they are similar
Definition: cacheiterators.h:211
pkgCache::FindPreferredPkg
PkgIterator FindPreferredPkg(bool const &PreferNonVirtual=true) const
find the package with the "best" architecture
pkgCache::SourceVerStr
const char * SourceVerStr() const
source version this version comes from Always contains the version string, even if it is the same as ...
Definition: cacheiterators.h:223
pkgCache::SourcePkgName
const char * SourcePkgName() const
source package name this version comes from Always contains the name, even if it is the same as the b...
Definition: cacheiterators.h:220
pkgCache::Dep::MultiArchImplicit
@ MultiArchImplicit
Definition: pkgcache.h:175
pkgCache::DependencyData
information for a single dependency record
Definition: pkgcache.h:738
pkgCache::DependencyProxy
Definition: cacheiterators.h:337
pkgCache::Flag::MultiArchImplicit
@ MultiArchImplicit
Definition: pkgcache.h:206
pkgCache::Flag::ReleaseFileFlags
ReleaseFileFlags
Definition: pkgcache.h:201
pkgCache::Flag::PkgFFlags
PkgFFlags
Definition: pkgcache.h:196
pkgCache::Group
groups architecture depending packages together
Definition: pkgcache.h:415
pkgCache::Package
contains information for a single unique package
Definition: pkgcache.h:450
pkgCache::Version
information for a single version of a package
Definition: pkgcache.h:625
pkgCache::Version::All
@ All
Definition: pkgcache.h:641