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