]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode: cpp; mode: fold -*- | |
2 | // Description /*{{{*/ | |
3 | // $Id: cacheiterators.h,v 1.18.2.1 2004/05/08 22:44:27 mdz Exp $ | |
4 | /* ###################################################################### | |
5 | ||
6 | Cache Iterators - Iterators for navigating the cache structure | |
7 | ||
8 | The iterators all provides ++,==,!=,->,* and end for their type. | |
9 | The end function can be used to tell if the list has been fully | |
10 | traversed. | |
11 | ||
12 | Unlike STL iterators these contain helper functions to access the data | |
13 | that is being iterated over. This is because the data structures can't | |
14 | be formed in a manner that is intuitive to use and also mmapable. | |
15 | ||
16 | For each variable in the target structure that would need a translation | |
17 | to be accessed correctly a translating function of the same name is | |
18 | present in the iterator. If applicable the translating function will | |
19 | return an iterator. | |
20 | ||
21 | The DepIterator can iterate over two lists, a list of 'version depends' | |
22 | or a list of 'package reverse depends'. The type is determined by the | |
23 | structure passed to the constructor, which should be the structure | |
24 | that has the depends pointer as a member. The provide iterator has the | |
25 | same system. | |
26 | ||
27 | This header is not user includable, please use apt-pkg/pkgcache.h | |
28 | ||
29 | ##################################################################### */ | |
30 | /*}}}*/ | |
31 | #ifndef PKGLIB_CACHEITERATORS_H | |
32 | #define PKGLIB_CACHEITERATORS_H | |
33 | ||
34 | ||
35 | // Package Iterator /*{{{*/ | |
36 | class pkgCache::PkgIterator | |
37 | { | |
38 | friend class pkgCache; | |
39 | Package *Pkg; | |
40 | pkgCache *Owner; | |
41 | long HashIndex; | |
42 | ||
43 | protected: | |
44 | ||
45 | // This constructor is the 'begin' constructor, never use it. | |
46 | inline PkgIterator(pkgCache &Owner) : Owner(&Owner), HashIndex(-1) | |
47 | { | |
48 | Pkg = Owner.PkgP; | |
49 | operator ++(0); | |
50 | }; | |
51 | ||
52 | public: | |
53 | ||
54 | enum OkState {NeedsNothing,NeedsUnpack,NeedsConfigure}; | |
55 | ||
56 | // Iteration | |
57 | void operator ++(int); | |
58 | inline void operator ++() {operator ++(0);}; | |
59 | inline bool end() const {return Owner == 0 || Pkg == Owner->PkgP?true:false;}; | |
60 | ||
61 | // Comparison | |
62 | inline bool operator ==(const PkgIterator &B) const {return Pkg == B.Pkg;}; | |
63 | inline bool operator !=(const PkgIterator &B) const {return Pkg != B.Pkg;}; | |
64 | ||
65 | // Accessors | |
66 | inline Package *operator ->() {return Pkg;}; | |
67 | inline Package const *operator ->() const {return Pkg;}; | |
68 | inline Package const &operator *() const {return *Pkg;}; | |
69 | inline operator Package *() {return Pkg == Owner->PkgP?0:Pkg;}; | |
70 | inline operator Package const *() const {return Pkg == Owner->PkgP?0:Pkg;}; | |
71 | inline pkgCache *Cache() {return Owner;}; | |
72 | ||
73 | inline const char *Name() const {return Pkg->Name == 0?0:Owner->StrP + Pkg->Name;}; | |
74 | inline const char *Display() const {return Pkg->Display == 0?0:Owner->StrP + Pkg->Display;}; | |
75 | inline const char *Section() const {return Pkg->Section == 0?0:Owner->StrP + Pkg->Section;}; | |
76 | inline bool Purge() const {return Pkg->CurrentState == pkgCache::State::Purge || | |
77 | (Pkg->CurrentVer == 0 && Pkg->CurrentState == pkgCache::State::NotInstalled);}; | |
78 | inline VerIterator VersionList() const; | |
79 | inline VerIterator CurrentVer() const; | |
80 | inline DepIterator RevDependsList() const; | |
81 | inline PrvIterator ProvidesList() const; | |
82 | inline TagIterator TagList() const; | |
83 | inline unsigned long Index() const {return Pkg - Owner->PkgP;}; | |
84 | OkState State() const; | |
85 | ||
86 | //Nice printable representation | |
87 | friend std::ostream& operator<<(std::ostream& out, pkgCache::PkgIterator Pkg); | |
88 | ||
89 | const char *CandVersion() const; | |
90 | const char *CurVersion() const; | |
91 | ||
92 | // Constructors | |
93 | inline PkgIterator(pkgCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner), | |
94 | HashIndex(0) | |
95 | { | |
96 | if (Pkg == 0) | |
97 | Pkg = Owner.PkgP; | |
98 | }; | |
99 | inline PkgIterator() : Pkg(0), Owner(0), HashIndex(0) {}; | |
100 | }; | |
101 | /*}}}*/ | |
102 | // Version Iterator /*{{{*/ | |
103 | class pkgCache::VerIterator | |
104 | { | |
105 | Version *Ver; | |
106 | pkgCache *Owner; | |
107 | ||
108 | void _dummy(); | |
109 | ||
110 | public: | |
111 | ||
112 | // Iteration | |
113 | void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver->NextVer;}; | |
114 | inline void operator ++() {operator ++(0);}; | |
115 | inline bool end() const {return Owner == 0 || (Ver == Owner->VerP?true:false);}; | |
116 | inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Owner;}; | |
117 | ||
118 | // Comparison | |
119 | inline bool operator ==(const VerIterator &B) const {return Ver == B.Ver;}; | |
120 | inline bool operator !=(const VerIterator &B) const {return Ver != B.Ver;}; | |
121 | int CompareVer(const VerIterator &B) const; | |
122 | ||
123 | // Testing | |
124 | inline bool IsGood() const { return Ver && Owner && ! end();}; | |
125 | ||
126 | // Accessors | |
127 | inline Version *operator ->() {return Ver;}; | |
128 | inline Version const *operator ->() const {return Ver;}; | |
129 | inline Version &operator *() {return *Ver;}; | |
130 | inline Version const &operator *() const {return *Ver;}; | |
131 | inline operator Version *() {return Ver == Owner->VerP?0:Ver;}; | |
132 | inline operator Version const *() const {return Ver == Owner->VerP?0:Ver;}; | |
133 | inline pkgCache *Cache() {return Owner;}; | |
134 | ||
135 | inline const char *VerStr() const {return Ver->VerStr == 0?0:Owner->StrP + Ver->VerStr;}; | |
136 | inline const char *Display() const {return Ver->Display == 0?0:Owner->StrP + Ver->Display;}; | |
137 | inline const char *Section() const {return Ver->Section == 0?0:Owner->StrP + Ver->Section;}; | |
138 | inline const char *Arch() const {return Ver->Arch == 0?0:Owner->StrP + Ver->Arch;}; | |
139 | inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Ver->ParentPkg);}; | |
140 | inline DescIterator DescriptionList() const; | |
141 | DescIterator TranslatedDescription() const; | |
142 | inline DepIterator DependsList() const; | |
143 | inline PrvIterator ProvidesList() const; | |
144 | inline VerFileIterator FileList() const; | |
145 | inline unsigned long Index() const {return Ver - Owner->VerP;}; | |
146 | bool Downloadable() const; | |
147 | inline const char *PriorityType() {return Owner->Priority(Ver->Priority);}; | |
148 | string RelStr(); | |
149 | ||
150 | bool Automatic() const; | |
151 | VerFileIterator NewestFile() const; | |
152 | ||
153 | inline VerIterator() : Ver(0), Owner(0) {}; | |
154 | inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg), | |
155 | Owner(&Owner) | |
156 | { | |
157 | if (Ver == 0) | |
158 | Ver = Owner.VerP; | |
159 | }; | |
160 | }; | |
161 | /*}}}*/ | |
162 | // Tag Iterator /*{{{*/ | |
163 | class pkgCache::TagIterator | |
164 | { | |
165 | Tag *Tg; | |
166 | pkgCache *Owner; | |
167 | ||
168 | void _dummy(); | |
169 | ||
170 | public: | |
171 | ||
172 | // Iteration | |
173 | void operator ++(int) {if (Tg != Owner->TagP) Tg = Owner->TagP + Tg->NextTag;}; | |
174 | inline void operator ++() {operator ++(0);}; | |
175 | inline bool end() const {return Tg == Owner->TagP?true:false;}; | |
176 | inline void operator =(const TagIterator &B) {Tg = B.Tg; Owner = B.Owner;}; | |
177 | ||
178 | // Comparison | |
179 | inline bool operator ==(const TagIterator &B) const {return Tg == B.Tg;}; | |
180 | inline bool operator !=(const TagIterator &B) const {return Tg != B.Tg;}; | |
181 | int CompareTag(const TagIterator &B) const; | |
182 | ||
183 | // Accessors | |
184 | inline Tag *operator ->() {return Tg;}; | |
185 | inline Tag const *operator ->() const {return Tg;}; | |
186 | inline Tag &operator *() {return *Tg;}; | |
187 | inline Tag const &operator *() const {return *Tg;}; | |
188 | inline operator Tag *() {return Tg == Owner->TagP?0:Tg;}; | |
189 | inline operator Tag const *() const {return Tg == Owner->TagP?0:Tg;}; | |
190 | inline pkgCache *Cache() {return Owner;}; | |
191 | ||
192 | inline const char *Name() const {return Owner->StrP + Tg->Name;}; | |
193 | inline unsigned long Index() const {return Tg - Owner->TagP;}; | |
194 | ||
195 | inline TagIterator() : Tg(0), Owner(0) {}; | |
196 | inline TagIterator(pkgCache &Owner,Tag *Trg = 0) : Tg(Trg), | |
197 | Owner(&Owner) | |
198 | { | |
199 | if (Tg == 0) | |
200 | Tg = Owner.TagP; | |
201 | }; | |
202 | }; | |
203 | /*}}}*/ | |
204 | // Description Iterator /*{{{*/ | |
205 | class pkgCache::DescIterator | |
206 | { | |
207 | Description *Desc; | |
208 | pkgCache *Owner; | |
209 | ||
210 | void _dummy(); | |
211 | ||
212 | public: | |
213 | ||
214 | // Iteration | |
215 | void operator ++(int) {if (Desc != Owner->DescP) Desc = Owner->DescP + Desc->NextDesc;}; | |
216 | inline void operator ++() {operator ++(0);}; | |
217 | inline bool end() const {return Owner == 0 || Desc == Owner->DescP?true:false;}; | |
218 | inline void operator =(const DescIterator &B) {Desc = B.Desc; Owner = B.Owner;}; | |
219 | ||
220 | // Comparison | |
221 | inline bool operator ==(const DescIterator &B) const {return Desc == B.Desc;}; | |
222 | inline bool operator !=(const DescIterator &B) const {return Desc != B.Desc;}; | |
223 | int CompareDesc(const DescIterator &B) const; | |
224 | ||
225 | // Accessors | |
226 | inline Description *operator ->() {return Desc;}; | |
227 | inline Description const *operator ->() const {return Desc;}; | |
228 | inline Description &operator *() {return *Desc;}; | |
229 | inline Description const &operator *() const {return *Desc;}; | |
230 | inline operator Description *() {return Desc == Owner->DescP?0:Desc;}; | |
231 | inline operator Description const *() const {return Desc == Owner->DescP?0:Desc;}; | |
232 | inline pkgCache *Cache() {return Owner;}; | |
233 | ||
234 | inline const char *LanguageCode() const {return Owner->StrP + Desc->language_code;}; | |
235 | inline const char *md5() const {return Owner->StrP + Desc->md5sum;}; | |
236 | inline DescFileIterator FileList() const; | |
237 | inline unsigned long Index() const {return Desc - Owner->DescP;}; | |
238 | ||
239 | inline DescIterator() : Desc(0), Owner(0) {}; | |
240 | inline DescIterator(pkgCache &Owner,Description *Trg = 0) : Desc(Trg), | |
241 | Owner(&Owner) | |
242 | { | |
243 | if (Desc == 0) | |
244 | Desc = Owner.DescP; | |
245 | }; | |
246 | }; | |
247 | /*}}}*/ | |
248 | // Dependency iterator /*{{{*/ | |
249 | class pkgCache::DepIterator | |
250 | { | |
251 | Dependency *Dep; | |
252 | enum {DepVer, DepRev} Type; | |
253 | pkgCache *Owner; | |
254 | ||
255 | void _dummy(); | |
256 | ||
257 | public: | |
258 | ||
259 | // Iteration | |
260 | void operator ++(int) {if (Dep != Owner->DepP) Dep = Owner->DepP + | |
261 | (Type == DepVer?Dep->NextDepends:Dep->NextRevDepends);}; | |
262 | inline void operator ++() {operator ++(0);}; | |
263 | inline bool end() const {return Owner == 0 || Dep == Owner->DepP?true:false;}; | |
264 | ||
265 | // Comparison | |
266 | inline bool operator ==(const DepIterator &B) const {return Dep == B.Dep;}; | |
267 | inline bool operator !=(const DepIterator &B) const {return Dep != B.Dep;}; | |
268 | ||
269 | // Accessors | |
270 | inline Dependency *operator ->() {return Dep;}; | |
271 | inline Dependency const *operator ->() const {return Dep;}; | |
272 | inline Dependency &operator *() {return *Dep;}; | |
273 | inline Dependency const &operator *() const {return *Dep;}; | |
274 | inline operator Dependency *() {return Dep == Owner->DepP?0:Dep;}; | |
275 | inline operator Dependency const *() const {return Dep == Owner->DepP?0:Dep;}; | |
276 | inline pkgCache *Cache() {return Owner;}; | |
277 | ||
278 | inline const char *TargetVer() const {return Dep->Version == 0?0:Owner->StrP + Dep->Version;}; | |
279 | inline PkgIterator TargetPkg() {return PkgIterator(*Owner,Owner->PkgP + Dep->Package);}; | |
280 | inline PkgIterator SmartTargetPkg() {PkgIterator R(*Owner,0);SmartTargetPkg(R);return R;}; | |
281 | inline VerIterator ParentVer() {return VerIterator(*Owner,Owner->VerP + Dep->ParentVer);}; | |
282 | inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Dep->ParentVer].ParentPkg);}; | |
283 | inline bool Reverse() {return Type == DepRev;}; | |
284 | inline unsigned long Index() const {return Dep - Owner->DepP;}; | |
285 | bool IsCritical(); | |
286 | void GlobOr(DepIterator &Start,DepIterator &End); | |
287 | Version **AllTargets(); | |
288 | bool SmartTargetPkg(PkgIterator &Result); | |
289 | inline const char *CompType() {return Owner->CompType(Dep->CompareOp);}; | |
290 | inline const char *DepType() {return Owner->DepType(Dep->Type);}; | |
291 | ||
292 | inline DepIterator(pkgCache &Owner,Dependency *Trg,Version * = 0) : | |
293 | Dep(Trg), Type(DepVer), Owner(&Owner) | |
294 | { | |
295 | if (Dep == 0) | |
296 | Dep = Owner.DepP; | |
297 | }; | |
298 | inline DepIterator(pkgCache &Owner,Dependency *Trg,Package *) : | |
299 | Dep(Trg), Type(DepRev), Owner(&Owner) | |
300 | { | |
301 | if (Dep == 0) | |
302 | Dep = Owner.DepP; | |
303 | }; | |
304 | inline DepIterator() : Dep(0), Type(DepVer), Owner(0) {}; | |
305 | }; | |
306 | /*}}}*/ | |
307 | // Provides iterator /*{{{*/ | |
308 | class pkgCache::PrvIterator | |
309 | { | |
310 | Provides *Prv; | |
311 | enum {PrvVer, PrvPkg} Type; | |
312 | pkgCache *Owner; | |
313 | ||
314 | void _dummy(); | |
315 | ||
316 | public: | |
317 | ||
318 | // Iteration | |
319 | void operator ++(int) {if (Prv != Owner->ProvideP) Prv = Owner->ProvideP + | |
320 | (Type == PrvVer?Prv->NextPkgProv:Prv->NextProvides);}; | |
321 | inline void operator ++() {operator ++(0);}; | |
322 | inline bool end() const {return Owner == 0 || Prv == Owner->ProvideP?true:false;}; | |
323 | ||
324 | // Comparison | |
325 | inline bool operator ==(const PrvIterator &B) const {return Prv == B.Prv;}; | |
326 | inline bool operator !=(const PrvIterator &B) const {return Prv != B.Prv;}; | |
327 | ||
328 | // Accessors | |
329 | inline Provides *operator ->() {return Prv;}; | |
330 | inline Provides const *operator ->() const {return Prv;}; | |
331 | inline Provides &operator *() {return *Prv;}; | |
332 | inline Provides const &operator *() const {return *Prv;}; | |
333 | inline operator Provides *() {return Prv == Owner->ProvideP?0:Prv;}; | |
334 | inline operator Provides const *() const {return Prv == Owner->ProvideP?0:Prv;}; | |
335 | inline pkgCache *Cache() {return Owner;}; | |
336 | ||
337 | inline const char *Name() const {return Owner->StrP + Owner->PkgP[Prv->ParentPkg].Name;}; | |
338 | inline const char *ProvideVersion() const {return Prv->ProvideVersion == 0?0:Owner->StrP + Prv->ProvideVersion;}; | |
339 | inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Prv->ParentPkg);}; | |
340 | inline VerIterator OwnerVer() {return VerIterator(*Owner,Owner->VerP + Prv->Version);}; | |
341 | inline PkgIterator OwnerPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Prv->Version].ParentPkg);}; | |
342 | inline unsigned long Index() const {return Prv - Owner->ProvideP;}; | |
343 | ||
344 | inline PrvIterator() : Prv(0), Type(PrvVer), Owner(0) {}; | |
345 | ||
346 | inline PrvIterator(pkgCache &Owner,Provides *Trg,Version *) : | |
347 | Prv(Trg), Type(PrvVer), Owner(&Owner) | |
348 | { | |
349 | if (Prv == 0) | |
350 | Prv = Owner.ProvideP; | |
351 | }; | |
352 | inline PrvIterator(pkgCache &Owner,Provides *Trg,Package *) : | |
353 | Prv(Trg), Type(PrvPkg), Owner(&Owner) | |
354 | { | |
355 | if (Prv == 0) | |
356 | Prv = Owner.ProvideP; | |
357 | }; | |
358 | }; | |
359 | /*}}}*/ | |
360 | // Package file /*{{{*/ | |
361 | class pkgCache::PkgFileIterator | |
362 | { | |
363 | pkgCache *Owner; | |
364 | PackageFile *File; | |
365 | ||
366 | public: | |
367 | ||
368 | // Iteration | |
369 | void operator ++(int) {if (File!= Owner->PkgFileP) File = Owner->PkgFileP + File->NextFile;}; | |
370 | inline void operator ++() {operator ++(0);}; | |
371 | inline bool end() const {return Owner == 0 || File == Owner->PkgFileP?true:false;}; | |
372 | ||
373 | // Comparison | |
374 | inline bool operator ==(const PkgFileIterator &B) const {return File == B.File;}; | |
375 | inline bool operator !=(const PkgFileIterator &B) const {return File != B.File;}; | |
376 | ||
377 | // Accessors | |
378 | inline PackageFile *operator ->() {return File;}; | |
379 | inline PackageFile const *operator ->() const {return File;}; | |
380 | inline PackageFile const &operator *() const {return *File;}; | |
381 | inline operator PackageFile *() {return File == Owner->PkgFileP?0:File;}; | |
382 | inline operator PackageFile const *() const {return File == Owner->PkgFileP?0:File;}; | |
383 | inline pkgCache *Cache() {return Owner;}; | |
384 | ||
385 | inline const char *FileName() const {return File->FileName == 0?0:Owner->StrP + File->FileName;}; | |
386 | inline const char *Archive() const {return File->Archive == 0?0:Owner->StrP + File->Archive;}; | |
387 | inline const char *Component() const {return File->Component == 0?0:Owner->StrP + File->Component;}; | |
388 | inline const char *Version() const {return File->Version == 0?0:Owner->StrP + File->Version;}; | |
389 | inline const char *Origin() const {return File->Origin == 0?0:Owner->StrP + File->Origin;}; | |
390 | inline const char *Label() const {return File->Label == 0?0:Owner->StrP + File->Label;}; | |
391 | inline const char *Site() const {return File->Site == 0?0:Owner->StrP + File->Site;}; | |
392 | inline const char *Architecture() const {return File->Architecture == 0?0:Owner->StrP + File->Architecture;}; | |
393 | inline const char *IndexType() const {return File->IndexType == 0?0:Owner->StrP + File->IndexType;}; | |
394 | ||
395 | inline unsigned long Index() const {return File - Owner->PkgFileP;}; | |
396 | ||
397 | bool IsOk(); | |
398 | string RelStr(); | |
399 | ||
400 | // Constructors | |
401 | inline PkgFileIterator() : Owner(0), File(0) {}; | |
402 | inline PkgFileIterator(pkgCache &Owner) : Owner(&Owner), File(Owner.PkgFileP) {}; | |
403 | inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Owner(&Owner), File(Trg) {}; | |
404 | }; | |
405 | /*}}}*/ | |
406 | // Version File /*{{{*/ | |
407 | class pkgCache::VerFileIterator | |
408 | { | |
409 | pkgCache *Owner; | |
410 | VerFile *FileP; | |
411 | ||
412 | public: | |
413 | ||
414 | // Iteration | |
415 | void operator ++(int) {if (FileP != Owner->VerFileP) FileP = Owner->VerFileP + FileP->NextFile;}; | |
416 | inline void operator ++() {operator ++(0);}; | |
417 | inline bool end() const {return Owner == 0 || FileP == Owner->VerFileP?true:false;}; | |
418 | ||
419 | // Comparison | |
420 | inline bool operator ==(const VerFileIterator &B) const {return FileP == B.FileP;}; | |
421 | inline bool operator !=(const VerFileIterator &B) const {return FileP != B.FileP;}; | |
422 | ||
423 | // Accessors | |
424 | inline VerFile *operator ->() {return FileP;}; | |
425 | inline VerFile const *operator ->() const {return FileP;}; | |
426 | inline VerFile const &operator *() const {return *FileP;}; | |
427 | inline operator VerFile *() {return FileP == Owner->VerFileP?0:FileP;}; | |
428 | inline operator VerFile const *() const {return FileP == Owner->VerFileP?0:FileP;}; | |
429 | inline pkgCache *Cache() {return Owner;}; | |
430 | ||
431 | inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP->File + Owner->PkgFileP);}; | |
432 | inline unsigned long Index() const {return FileP - Owner->VerFileP;}; | |
433 | ||
434 | inline VerFileIterator() : Owner(0), FileP(0) {}; | |
435 | inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {}; | |
436 | }; | |
437 | /*}}}*/ | |
438 | // Description File /*{{{*/ | |
439 | class pkgCache::DescFileIterator | |
440 | { | |
441 | pkgCache *Owner; | |
442 | DescFile *FileP; | |
443 | ||
444 | public: | |
445 | ||
446 | // Iteration | |
447 | void operator ++(int) {if (FileP != Owner->DescFileP) FileP = Owner->DescFileP + FileP->NextFile;}; | |
448 | inline void operator ++() {operator ++(0);}; | |
449 | inline bool end() const {return Owner == 0 || FileP == Owner->DescFileP?true:false;}; | |
450 | ||
451 | // Comparison | |
452 | inline bool operator ==(const DescFileIterator &B) const {return FileP == B.FileP;}; | |
453 | inline bool operator !=(const DescFileIterator &B) const {return FileP != B.FileP;}; | |
454 | ||
455 | // Accessors | |
456 | inline DescFile *operator ->() {return FileP;}; | |
457 | inline DescFile const *operator ->() const {return FileP;}; | |
458 | inline DescFile const &operator *() const {return *FileP;}; | |
459 | inline operator DescFile *() {return FileP == Owner->DescFileP?0:FileP;}; | |
460 | inline operator DescFile const *() const {return FileP == Owner->DescFileP?0:FileP;}; | |
461 | inline pkgCache *Cache() {return Owner;}; | |
462 | ||
463 | inline PkgFileIterator File() const {return PkgFileIterator(*Owner,FileP->File + Owner->PkgFileP);}; | |
464 | inline unsigned long Index() const {return FileP - Owner->DescFileP;}; | |
465 | ||
466 | inline DescFileIterator() : Owner(0), FileP(0) {}; | |
467 | inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), FileP(Trg) {}; | |
468 | }; | |
469 | /*}}}*/ | |
470 | // Inlined Begin functions cant be in the class because of order problems /*{{{*/ | |
471 | inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const | |
472 | {return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);}; | |
473 | inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const | |
474 | {return VerIterator(*Owner,Owner->VerP + Pkg->CurrentVer);}; | |
475 | inline pkgCache::DepIterator pkgCache::PkgIterator::RevDependsList() const | |
476 | {return DepIterator(*Owner,Owner->DepP + Pkg->RevDepends,Pkg);}; | |
477 | inline pkgCache::PrvIterator pkgCache::PkgIterator::ProvidesList() const | |
478 | {return PrvIterator(*Owner,Owner->ProvideP + Pkg->ProvidesList,Pkg);}; | |
479 | inline pkgCache::TagIterator pkgCache::PkgIterator::TagList() const | |
480 | {return TagIterator(*Owner,Owner->TagP + Pkg->TagList);}; | |
481 | inline pkgCache::DescIterator pkgCache::VerIterator::DescriptionList() const | |
482 | {return DescIterator(*Owner,Owner->DescP + Ver->DescriptionList);}; | |
483 | inline pkgCache::PrvIterator pkgCache::VerIterator::ProvidesList() const | |
484 | {return PrvIterator(*Owner,Owner->ProvideP + Ver->ProvidesList,Ver);}; | |
485 | inline pkgCache::DepIterator pkgCache::VerIterator::DependsList() const | |
486 | {return DepIterator(*Owner,Owner->DepP + Ver->DependsList,Ver);}; | |
487 | inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const | |
488 | {return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);}; | |
489 | inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const | |
490 | {return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);}; | |
491 | /*}}}*/ | |
492 | #endif |