apt: apt-pkg/cacheiterators.h Source File

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