]> git.saurik.com Git - apt.git/blob - apt-pkg/pkgcache.h
* apt-pkg/depcache.cc:
[apt.git] / apt-pkg / pkgcache.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /**\file pkgcache.h
4 \brief pkgCache - Structure definitions for the cache file
5
6 The goal of the cache file is two fold:
7 Firstly to speed loading and processing of the package file array and
8 secondly to reduce memory consumption of the package file array.
9
10 The implementation is aimed at an environment with many primary package
11 files, for instance someone that has a Package file for their CD-ROM, a
12 Package file for the latest version of the distribution on the CD-ROM and a
13 package file for the development version. Always present is the information
14 contained in the status file which might be considered a separate package
15 file.
16
17 Please understand, this is designed as a <b>Cache file</b> it is not meant to be
18 used on any system other than the one it was created for. It is not meant to
19 be authoritative either, i.e. if a system crash or software failure occurs it
20 must be perfectly acceptable for the cache file to be in an inconsistent
21 state. Furthermore at any time the cache file may be erased without losing
22 any information.
23
24 Also the structures and storage layout is optimized for use by the APT
25 and may not be suitable for all purposes. However it should be possible
26 to extend it with associate cache files that contain other information.
27
28 To keep memory use down the cache file only contains often used fields and
29 fields that are inexpensive to store, the Package file has a full list of
30 fields. Also the client may assume that all items are perfectly valid and
31 need not perform checks against their correctness. Removal of information
32 from the cache is possible, but blanks will be left in the file, and
33 unused strings will also be present. The recommended implementation is to
34 simply rebuild the cache each time any of the data files change. It is
35 possible to add a new package file to the cache without any negative side
36 effects.
37
38 <b>Note on Pointer access</b>
39 Clients should always use the CacheIterators classes for access to the
40 cache and the data in it. They also provide a simple STL-like method for
41 traversing the links of the datastructure.
42
43 Every item in every structure is stored as the index to that structure.
44 What this means is that once the files is mmaped every data access has to
45 go through a fix up stage to get a real memory pointer. This is done
46 by taking the index, multiplying it by the type size and then adding
47 it to the start address of the memory block. This sounds complex, but
48 in C it is a single array dereference. Because all items are aligned to
49 their size and indexes are stored as multiples of the size of the structure
50 the format is immediately portable to all possible architectures - BUT the
51 generated files are -NOT-.
52
53 This scheme allows code like this to be written:
54 <example>
55 void *Map = mmap(...);
56 Package *PkgList = (Package *)Map;
57 Header *Head = (Header *)Map;
58 char *Strings = (char *)Map;
59 cout << (Strings + PkgList[Head->HashTable[0]]->Name) << endl;
60 </example>
61 Notice the lack of casting or multiplication. The net result is to return
62 the name of the first package in the first hash bucket, without error
63 checks.
64
65 The generator uses allocation pools to group similarly sized structures in
66 large blocks to eliminate any alignment overhead. The generator also
67 assures that no structures overlap and all indexes are unique. Although
68 at first glance it may seem like there is the potential for two structures
69 to exist at the same point the generator never allows this to happen.
70 (See the discussion of free space pools)
71
72 See \ref pkgcachegen.h for more information about generating cache structures. */
73 /*}}}*/
74 #ifndef PKGLIB_PKGCACHE_H
75 #define PKGLIB_PKGCACHE_H
76
77
78 #include <string>
79 #include <time.h>
80 #include <apt-pkg/mmap.h>
81
82 class pkgVersioningSystem;
83 class pkgCache /*{{{*/
84 {
85 public:
86 // Cache element predeclarations
87 struct Header;
88 struct Group;
89 struct Package;
90 struct PackageFile;
91 struct Version;
92 struct Description;
93 struct Provides;
94 struct Dependency;
95 struct StringItem;
96 struct VerFile;
97 struct DescFile;
98
99 // Iterators
100 template<typename Str, typename Itr> class Iterator;
101 class GrpIterator;
102 class PkgIterator;
103 class VerIterator;
104 class DescIterator;
105 class DepIterator;
106 class PrvIterator;
107 class PkgFileIterator;
108 class VerFileIterator;
109 class DescFileIterator;
110
111 class Namespace;
112
113 // These are all the constants used in the cache structures
114
115 // WARNING - if you change these lists you must also edit
116 // the stringification in pkgcache.cc and also consider whether
117 // the cache file will become incompatible.
118 struct Dep
119 {
120 enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,
121 Conflicts=5,Replaces=6,Obsoletes=7,DpkgBreaks=8,Enhances=9};
122 /** \brief available compare operators
123
124 The lower 4 bits are used to indicate what operator is being specified and
125 the upper 4 bits are flags. OR indicates that the next package is
126 or'd with the current package. */
127 enum DepCompareOp {Or=0x10,NoOp=0,LessEq=0x1,GreaterEq=0x2,Less=0x3,
128 Greater=0x4,Equals=0x5,NotEquals=0x6};
129 };
130
131 struct State
132 {
133 /** \brief priority of a package version
134
135 Zero is used for unparsable or absent Priority fields. */
136 enum VerPriority {Important=1,Required=2,Standard=3,Optional=4,Extra=5};
137 enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4};
138 enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3};
139 enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2,
140 HalfInstalled=4,ConfigFiles=5,Installed=6,
141 TriggersAwaited=7,TriggersPending=8};
142 };
143
144 struct Flag
145 {
146 enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)};
147 enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1),ButAutomaticUpgrades=(1<<2)};
148 };
149
150 protected:
151
152 // Memory mapped cache file
153 std::string CacheFile;
154 MMap &Map;
155
156 unsigned long sHash(const std::string &S) const;
157 unsigned long sHash(const char *S) const;
158
159 public:
160
161 // Pointers to the arrays of items
162 Header *HeaderP;
163 Group *GrpP;
164 Package *PkgP;
165 VerFile *VerFileP;
166 DescFile *DescFileP;
167 PackageFile *PkgFileP;
168 Version *VerP;
169 Description *DescP;
170 Provides *ProvideP;
171 Dependency *DepP;
172 StringItem *StringItemP;
173 char *StrP;
174
175 virtual bool ReMap(bool const &Errorchecks = true);
176 inline bool Sync() {return Map.Sync();};
177 inline MMap &GetMap() {return Map;};
178 inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();};
179
180 // String hashing function (512 range)
181 inline unsigned long Hash(const std::string &S) const {return sHash(S);};
182 inline unsigned long Hash(const char *S) const {return sHash(S);};
183
184 // Useful transformation things
185 const char *Priority(unsigned char Priority);
186
187 // Accessors
188 GrpIterator FindGrp(const std::string &Name);
189 PkgIterator FindPkg(const std::string &Name);
190 PkgIterator FindPkg(const std::string &Name, const std::string &Arch);
191
192 Header &Head() {return *HeaderP;};
193 inline GrpIterator GrpBegin();
194 inline GrpIterator GrpEnd();
195 inline PkgIterator PkgBegin();
196 inline PkgIterator PkgEnd();
197 inline PkgFileIterator FileBegin();
198 inline PkgFileIterator FileEnd();
199
200 inline bool MultiArchCache() const { return MultiArchEnabled; };
201 inline char const * const NativeArch() const;
202
203 // Make me a function
204 pkgVersioningSystem *VS;
205
206 // Converters
207 static const char *CompTypeDeb(unsigned char Comp);
208 static const char *CompType(unsigned char Comp);
209 static const char *DepType(unsigned char Dep);
210
211 pkgCache(MMap *Map,bool DoMap = true);
212 virtual ~pkgCache() {};
213
214 private:
215 bool MultiArchEnabled;
216 PkgIterator SingleArchFindPkg(const std::string &Name);
217 };
218 /*}}}*/
219 // Header structure /*{{{*/
220 struct pkgCache::Header
221 {
222 /** \brief Signature information
223
224 This must contain the hex value 0x98FE76DC which is designed to
225 verify that the system loading the image has the same byte order
226 and byte size as the system saving the image */
227 unsigned long Signature;
228 /** These contain the version of the cache file */
229 short MajorVersion;
230 short MinorVersion;
231 /** \brief indicates if the cache should be erased
232
233 Dirty is true if the cache file was opened for reading, the client
234 expects to have written things to it and have not fully synced it.
235 The file should be erased and rebuilt if it is true. */
236 bool Dirty;
237
238 /** \brief Size of structure values
239
240 All *Sz variables contains the sizeof() that particular structure.
241 It is used as an extra consistency check on the structure of the file.
242
243 If any of the size values do not exactly match what the client expects
244 then the client should refuse the load the file. */
245 unsigned short HeaderSz;
246 unsigned short GroupSz;
247 unsigned short PackageSz;
248 unsigned short PackageFileSz;
249 unsigned short VersionSz;
250 unsigned short DescriptionSz;
251 unsigned short DependencySz;
252 unsigned short ProvidesSz;
253 unsigned short VerFileSz;
254 unsigned short DescFileSz;
255
256 /** \brief Structure counts
257
258 These indicate the number of each structure contained in the cache.
259 PackageCount is especially useful for generating user state structures.
260 See Package::Id for more info. */
261 unsigned long GroupCount;
262 unsigned long PackageCount;
263 unsigned long VersionCount;
264 unsigned long DescriptionCount;
265 unsigned long DependsCount;
266 unsigned long PackageFileCount;
267 unsigned long VerFileCount;
268 unsigned long DescFileCount;
269 unsigned long ProvidesCount;
270
271 /** \brief index of the first PackageFile structure
272
273 The PackageFile structures are singly linked lists that represent
274 all package files that have been merged into the cache. */
275 map_ptrloc FileList;
276 /** \brief index of the first StringItem structure
277
278 The cache contains a list of all the unique strings (StringItems).
279 The parser reads this list into memory so it can match strings
280 against it.*/
281 map_ptrloc StringList;
282 /** \brief String representing the version system used */
283 map_ptrloc VerSysName;
284 /** \brief Architecture(s) the cache was built against */
285 map_ptrloc Architecture;
286 /** \brief The maximum size of a raw entry from the original Package file */
287 unsigned long MaxVerFileSize;
288 /** \brief The maximum size of a raw entry from the original Translation file */
289 unsigned long MaxDescFileSize;
290
291 /** \brief The Pool structures manage the allocation pools that the generator uses
292
293 Start indicates the first byte of the pool, Count is the number of objects
294 remaining in the pool and ItemSize is the structure size (alignment factor)
295 of the pool. An ItemSize of 0 indicates the pool is empty. There should be
296 the same number of pools as there are structure types. The generator
297 stores this information so future additions can make use of any unused pool
298 blocks. */
299 DynamicMMap::Pool Pools[9];
300
301 /** \brief hash tables providing rapid group/package name lookup
302
303 Each group/package name is inserted into the hash table using pkgCache::Hash(const &string)
304 By iterating over each entry in the hash table it is possible to iterate over
305 the entire list of packages. Hash Collisions are handled with a singly linked
306 list of packages based at the hash item. The linked list contains only
307 packages that match the hashing function.
308 In the PkgHashTable is it possible that multiple packages have the same name -
309 these packages are stored as a sequence in the list.
310
311 Beware: The Hashmethod assumes that the hash table sizes are equal */
312 map_ptrloc PkgHashTable[2*1048];
313 map_ptrloc GrpHashTable[2*1048];
314
315 /** \brief Size of the complete cache file */
316 unsigned long CacheFileSize;
317
318 bool CheckSizes(Header &Against) const;
319 Header();
320 };
321 /*}}}*/
322 // Group structure /*{{{*/
323 /** \brief groups architecture depending packages together
324
325 On or more packages with the same name form a group, so we have
326 a simple way to access a package built for different architectures
327 Group exists in a singly linked list of group records starting at
328 the hash index of the name in the pkgCache::Header::GrpHashTable */
329 struct pkgCache::Group
330 {
331 /** \brief Name of the group */
332 map_ptrloc Name; // StringItem
333
334 // Linked List
335 /** \brief Link to the first package which belongs to the group */
336 map_ptrloc FirstPackage; // Package
337 /** \brief Link to the last package which belongs to the group */
338 map_ptrloc LastPackage; // Package
339 /** \brief Link to the next Group */
340 map_ptrloc Next; // Group
341 /** \brief unique sequel ID */
342 unsigned int ID;
343
344 };
345 /*}}}*/
346 // Package structure /*{{{*/
347 /** \brief contains information for a single unique package
348
349 There can be any number of versions of a given package.
350 Package exists in a singly linked list of package records starting at
351 the hash index of the name in the pkgCache::Header::PkgHashTable
352
353 A package can be created for every architecture so package names are
354 not unique, but it is garanteed that packages with the same name
355 are sequencel ordered in the list. Packages with the same name can be
356 accessed with the Group.
357 */
358 struct pkgCache::Package
359 {
360 /** \brief Name of the package */
361 map_ptrloc Name; // StringItem
362 /** \brief Architecture of the package */
363 map_ptrloc Arch; // StringItem
364 /** \brief Base of a singly linked list of versions
365
366 Each structure represents a unique version of the package.
367 The version structures contain links into PackageFile and the
368 original text file as well as detailed information about the size
369 and dependencies of the specific package. In this way multiple
370 versions of a package can be cleanly handled by the system.
371 Furthermore, this linked list is guaranteed to be sorted
372 from Highest version to lowest version with no duplicate entries. */
373 map_ptrloc VersionList; // Version
374 /** \brief index to the installed version */
375 map_ptrloc CurrentVer; // Version
376 /** \brief indicates the deduced section
377
378 Should be the index to the string "Unknown" or to the section
379 of the last parsed item. */
380 map_ptrloc Section; // StringItem
381 /** \brief index of the group this package belongs to */
382 map_ptrloc Group; // Group the Package belongs to
383
384 // Linked list
385 /** \brief Link to the next package in the same bucket */
386 map_ptrloc NextPackage; // Package
387 /** \brief List of all dependencies on this package */
388 map_ptrloc RevDepends; // Dependency
389 /** \brief List of all "packages" this package provide */
390 map_ptrloc ProvidesList; // Provides
391
392 // Install/Remove/Purge etc
393 /** \brief state that the user wishes the package to be in */
394 unsigned char SelectedState; // What
395 /** \brief installation state of the package
396
397 This should be "ok" but in case the installation failed
398 it will be different.
399 */
400 unsigned char InstState; // Flags
401 /** \brief indicates if the package is installed */
402 unsigned char CurrentState; // State
403
404 /** \brief unique sequel ID
405
406 ID is a unique value from 0 to Header->PackageCount assigned by the generator.
407 This allows clients to create an array of size PackageCount and use it to store
408 state information for the package map. For instance the status file emitter uses
409 this to track which packages have been emitted already. */
410 unsigned int ID;
411 /** \brief some useful indicators of the package's state */
412 unsigned long Flags;
413 };
414 /*}}}*/
415 // Package File structure /*{{{*/
416 /** \brief stores information about the files used to generate the cache
417
418 Package files are referenced by Version structures to be able to know
419 after the generation still from which Packages file includes this Version
420 as we need this information later on e.g. for pinning. */
421 struct pkgCache::PackageFile
422 {
423 /** \brief physical disk file that this PackageFile represents */
424 map_ptrloc FileName; // StringItem
425 /** \brief the release information
426
427 Please see the files document for a description of what the
428 release information means. */
429 map_ptrloc Archive; // StringItem
430 map_ptrloc Codename; // StringItem
431 map_ptrloc Component; // StringItem
432 map_ptrloc Version; // StringItem
433 map_ptrloc Origin; // StringItem
434 map_ptrloc Label; // StringItem
435 map_ptrloc Architecture; // StringItem
436 /** \brief The site the index file was fetched from */
437 map_ptrloc Site; // StringItem
438 /** \brief indicates what sort of index file this is
439
440 @TODO enumerate at least the possible indexes */
441 map_ptrloc IndexType; // StringItem
442 /** \brief Size of the file
443
444 Used together with the modification time as a
445 simple check to ensure that the Packages
446 file has not been altered since Cache generation. */
447 unsigned long Size;
448 /** \brief Modification time for the file */
449 time_t mtime;
450
451 /* @TODO document PackageFile::Flags */
452 unsigned long Flags;
453
454 // Linked list
455 /** \brief Link to the next PackageFile in the Cache */
456 map_ptrloc NextFile; // PackageFile
457 /** \brief unique sequel ID */
458 unsigned int ID;
459 };
460 /*}}}*/
461 // VerFile structure /*{{{*/
462 /** \brief associates a version with a PackageFile
463
464 This allows a full description of all Versions in all files
465 (and hence all sources) under consideration. */
466 struct pkgCache::VerFile
467 {
468 /** \brief index of the package file that this version was found in */
469 map_ptrloc File; // PackageFile
470 /** \brief next step in the linked list */
471 map_ptrloc NextFile; // PkgVerFile
472 /** \brief position in the package file */
473 map_ptrloc Offset; // File offset
474 /* @TODO document pkgCache::VerFile::Size */
475 unsigned long Size;
476 };
477 /*}}}*/
478 // DescFile structure /*{{{*/
479 /** \brief associates a description with a Translation file */
480 struct pkgCache::DescFile
481 {
482 /** \brief index of the file that this description was found in */
483 map_ptrloc File; // PackageFile
484 /** \brief next step in the linked list */
485 map_ptrloc NextFile; // PkgVerFile
486 /** \brief position in the file */
487 map_ptrloc Offset; // File offset
488 /* @TODO document pkgCache::DescFile::Size */
489 unsigned long Size;
490 };
491 /*}}}*/
492 // Version structure /*{{{*/
493 /** \brief information for a single version of a package
494
495 The version list is always sorted from highest version to lowest
496 version by the generator. Equal version numbers are either merged
497 or handled as separate versions based on the Hash value. */
498 struct pkgCache::Version
499 {
500 /** \brief complete version string */
501 map_ptrloc VerStr; // StringItem
502 /** \brief section this version is filled in */
503 map_ptrloc Section; // StringItem
504
505 /** \brief Multi-Arch capabilities of a package version */
506 enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger special behaviour */
507 All = (1<<0), /*!< will cause that Ver.Arch() will report "all" */
508 Foreign = (1<<1), /*!< can satisfy dependencies in another architecture */
509 Same = (1<<2), /*!< can be co-installed with itself from other architectures */
510 Allowed = (1<<3), /*!< other packages are allowed to depend on thispkg:any */
511 AllForeign = All | Foreign,
512 AllAllowed = All | Allowed };
513 /** \brief stores the MultiArch capabilities of this version
514
515 Flags used are defined in pkgCache::Version::VerMultiArch
516 */
517 unsigned char MultiArch;
518
519 /** \brief references all the PackageFile's that this version came from
520
521 FileList can be used to determine what distribution(s) the Version
522 applies to. If FileList is 0 then this is a blank version.
523 The structure should also have a 0 in all other fields excluding
524 pkgCache::Version::VerStr and Possibly pkgCache::Version::NextVer. */
525 map_ptrloc FileList; // VerFile
526 /** \brief next (lower or equal) version in the linked list */
527 map_ptrloc NextVer; // Version
528 /** \brief next description in the linked list */
529 map_ptrloc DescriptionList; // Description
530 /** \brief base of the dependency list */
531 map_ptrloc DependsList; // Dependency
532 /** \brief links to the owning package
533
534 This allows reverse dependencies to determine the package */
535 map_ptrloc ParentPkg; // Package
536 /** \brief list of pkgCache::Provides */
537 map_ptrloc ProvidesList; // Provides
538
539 /** \brief archive size for this version
540
541 For Debian this is the size of the .deb file. */
542 unsigned long long Size; // These are the .deb size
543 /** \brief uncompressed size for this version */
544 unsigned long long InstalledSize;
545 /** \brief characteristic value representing this version
546
547 No two packages in existence should have the same VerStr
548 and Hash with different contents. */
549 unsigned short Hash;
550 /** \brief unique sequel ID */
551 unsigned int ID;
552 /** \brief parsed priority value */
553 unsigned char Priority;
554 };
555 /*}}}*/
556 // Description structure /*{{{*/
557 /** \brief datamember of a linked list of available description for a version */
558 struct pkgCache::Description
559 {
560 /** \brief Language code of this description (translation)
561
562 If the value has a 0 length then this is read using the Package
563 file else the Translation-CODE file is used. */
564 map_ptrloc language_code; // StringItem
565 /** \brief MD5sum of the original description
566
567 Used to map Translations of a description to a version
568 and to check that the Translation is up-to-date. */
569 map_ptrloc md5sum; // StringItem
570
571 /* @TODO document pkgCache::Description::FileList */
572 map_ptrloc FileList; // DescFile
573 /** \brief next translation for this description */
574 map_ptrloc NextDesc; // Description
575 /** \brief the text is a description of this package */
576 map_ptrloc ParentPkg; // Package
577
578 /** \brief unique sequel ID */
579 unsigned int ID;
580 };
581 /*}}}*/
582 // Dependency structure /*{{{*/
583 /** \brief information for a single dependency record
584
585 The records are split up like this to ease processing by the client.
586 The base of the linked list is pkgCache::Version::DependsList.
587 All forms of dependencies are recorded here including Depends,
588 Recommends, Suggests, Enhances, Conflicts, Replaces and Breaks. */
589 struct pkgCache::Dependency
590 {
591 /** \brief string of the version the dependency is applied against */
592 map_ptrloc Version; // StringItem
593 /** \brief index of the package this depends applies to
594
595 The generator will - if the package does not already exist -
596 create a blank (no version records) package. */
597 map_ptrloc Package; // Package
598 /** \brief next dependency of this version */
599 map_ptrloc NextDepends; // Dependency
600 /** \brief next reverse dependency of this package */
601 map_ptrloc NextRevDepends; // Dependency
602 /** \brief version of the package which has the reverse depends */
603 map_ptrloc ParentVer; // Version
604
605 /** \brief unique sequel ID */
606 map_ptrloc ID;
607 /** \brief Dependency type - Depends, Recommends, Conflicts, etc */
608 unsigned char Type;
609 /** \brief comparison operator specified on the depends line
610
611 If the high bit is set then it is a logical OR with the previous record. */
612 unsigned char CompareOp;
613 };
614 /*}}}*/
615 // Provides structure /*{{{*/
616 /** \brief handles virtual packages
617
618 When a Provides: line is encountered a new provides record is added
619 associating the package with a virtual package name.
620 The provides structures are linked off the package structures.
621 This simplifies the analysis of dependencies and other aspects A provides
622 refers to a specific version of a specific package, not all versions need to
623 provide that provides.*/
624 struct pkgCache::Provides
625 {
626 /** \brief index of the package providing this */
627 map_ptrloc ParentPkg; // Package
628 /** \brief index of the version this provide line applies to */
629 map_ptrloc Version; // Version
630 /** \brief version in the provides line (if any)
631
632 This version allows dependencies to depend on specific versions of a
633 Provides, as well as allowing Provides to override existing packages.
634 This is experimental. Note that Debian doesn't allow versioned provides */
635 map_ptrloc ProvideVersion; // StringItem
636 /** \brief next provides (based of package) */
637 map_ptrloc NextProvides; // Provides
638 /** \brief next provides (based of version) */
639 map_ptrloc NextPkgProv; // Provides
640 };
641 /*}}}*/
642 // StringItem structure /*{{{*/
643 /** \brief used for generating single instances of strings
644
645 Some things like Section Name are are useful to have as unique tags.
646 It is part of a linked list based at pkgCache::Header::StringList
647
648 All strings are simply inlined any place in the file that is natural
649 for the writer. The client should make no assumptions about the positioning
650 of strings. All StringItems should be null-terminated. */
651 struct pkgCache::StringItem
652 {
653 /** \brief string this refers to */
654 map_ptrloc String; // StringItem
655 /** \brief Next link in the chain */
656 map_ptrloc NextItem; // StringItem
657 };
658 /*}}}*/
659
660
661 inline char const * const pkgCache::NativeArch() const
662 { return StrP + HeaderP->Architecture; };
663
664 #include <apt-pkg/cacheiterators.h>
665
666 inline pkgCache::GrpIterator pkgCache::GrpBegin()
667 {return GrpIterator(*this);};
668 inline pkgCache::GrpIterator pkgCache::GrpEnd()
669 {return GrpIterator(*this,GrpP);};
670 inline pkgCache::PkgIterator pkgCache::PkgBegin()
671 {return PkgIterator(*this);};
672 inline pkgCache::PkgIterator pkgCache::PkgEnd()
673 {return PkgIterator(*this,PkgP);};
674 inline pkgCache::PkgFileIterator pkgCache::FileBegin()
675 {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);};
676 inline pkgCache::PkgFileIterator pkgCache::FileEnd()
677 {return PkgFileIterator(*this,PkgFileP);};
678
679 // Oh I wish for Real Name Space Support
680 class pkgCache::Namespace /*{{{*/
681 {
682 public:
683 typedef pkgCache::GrpIterator GrpIterator;
684 typedef pkgCache::PkgIterator PkgIterator;
685 typedef pkgCache::VerIterator VerIterator;
686 typedef pkgCache::DescIterator DescIterator;
687 typedef pkgCache::DepIterator DepIterator;
688 typedef pkgCache::PrvIterator PrvIterator;
689 typedef pkgCache::PkgFileIterator PkgFileIterator;
690 typedef pkgCache::VerFileIterator VerFileIterator;
691 typedef pkgCache::Version Version;
692 typedef pkgCache::Description Description;
693 typedef pkgCache::Package Package;
694 typedef pkgCache::Header Header;
695 typedef pkgCache::Dep Dep;
696 typedef pkgCache::Flag Flag;
697 };
698 /*}}}*/
699 #endif