1 // -*- mode: cpp; mode: fold -*-
4 \brief pkgCache - Structure definitions for the cache file
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.
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
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
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.
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
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.
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-.
53 This scheme allows code like this to be written:
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;
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
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)
72 See \ref pkgcachegen.h for more information about generating cache structures. */
74 #ifndef PKGLIB_PKGCACHE_H
75 #define PKGLIB_PKGCACHE_H
77 #include <apt-pkg/mmap.h>
78 #include <apt-pkg/macros.h>
84 #ifndef APT_8_CLEANER_HEADERS
88 // size of (potentially big) files like debs or the install size of them
89 typedef uint64_t map_filesize_t
;
90 // storing file sizes of indexes, which are way below 4 GB for now
91 typedef uint32_t map_filesize_small_t
;
92 // each package/group/dependency gets an id
93 typedef uint32_t map_id_t
;
94 // some files get an id, too, but in far less absolute numbers
95 typedef uint16_t map_fileid_t
;
96 // relative pointer from cache start
97 typedef uint32_t map_pointer_t
;
98 // same as the previous, but documented to be to a string item
99 typedef map_pointer_t map_stringitem_t
;
101 class pkgVersioningSystem
;
102 class pkgCache
/*{{{*/
105 // Cache element predeclarations
115 struct DependencyData
;
121 template<typename Str
, typename Itr
> class Iterator
;
128 class RlsFileIterator
;
129 class PkgFileIterator
;
130 class VerFileIterator
;
131 class DescFileIterator
;
135 // These are all the constants used in the cache structures
137 // WARNING - if you change these lists you must also edit
138 // the stringification in pkgcache.cc and also consider whether
139 // the cache file will become incompatible.
142 enum DepType
{Depends
=1,PreDepends
=2,Suggests
=3,Recommends
=4,
143 Conflicts
=5,Replaces
=6,Obsoletes
=7,DpkgBreaks
=8,Enhances
=9};
144 /** \brief available compare operators
146 The lower 4 bits are used to indicate what operator is being specified and
147 the upper 4 bits are flags. OR indicates that the next package is
148 or'd with the current package. */
149 enum DepCompareOp
{Or
=0x10,NoOp
=0,LessEq
=0x1,GreaterEq
=0x2,Less
=0x3,
150 Greater
=0x4,Equals
=0x5,NotEquals
=0x6};
155 /** \brief priority of a package version
157 Zero is used for unparsable or absent Priority fields. */
158 enum VerPriority
{Required
=1,Important
=2,Standard
=3,Optional
=4,Extra
=5};
159 enum PkgSelectedState
{Unknown
=0,Install
=1,Hold
=2,DeInstall
=3,Purge
=4};
160 enum PkgInstState
{Ok
=0,ReInstReq
=1,HoldInst
=2,HoldReInstReq
=3};
161 enum PkgCurrentState
{NotInstalled
=0,UnPacked
=1,HalfConfigured
=2,
162 HalfInstalled
=4,ConfigFiles
=5,Installed
=6,
163 TriggersAwaited
=7,TriggersPending
=8};
168 enum PkgFlags
{Auto
=(1<<0),Essential
=(1<<3),Important
=(1<<4)};
170 NotSource
=(1<<0), /*!< packages can't be fetched from here, e.g. dpkg/status file */
171 LocalSource
=(1<<1), /*!< local sources can't and will not be verified by hashes */
172 NoPackages
=(1<<2), /*!< the file includes no package records itself, but additions like Translations */
174 enum ReleaseFileFlags
{
175 NotAutomatic
=(1<<0), /*!< archive has a default pin of 1 */
176 ButAutomaticUpgrades
=(1<<1), /*!< (together with the previous) archive has a default pin of 100 */
182 // Memory mapped cache file
183 std::string CacheFile
;
186 map_id_t
sHash(const std::string
&S
) const APT_PURE
;
187 map_id_t
sHash(const char *S
) const APT_PURE
;
191 // Pointers to the arrays of items
197 ReleaseFile
*RlsFileP
;
198 PackageFile
*PkgFileP
;
203 DependencyData
*DepDataP
;
204 APT_DEPRECATED StringItem
*StringItemP
;
207 virtual bool ReMap(bool const &Errorchecks
= true);
208 inline bool Sync() {return Map
.Sync();}
209 inline MMap
&GetMap() {return Map
;}
210 inline void *DataEnd() {return ((unsigned char *)Map
.Data()) + Map
.Size();}
212 // String hashing function (512 range)
213 inline map_id_t
Hash(const std::string
&S
) const {return sHash(S
);}
214 inline map_id_t
Hash(const char *S
) const {return sHash(S
);}
216 // Useful transformation things
217 const char *Priority(unsigned char Priority
);
220 GrpIterator
FindGrp(const std::string
&Name
);
221 PkgIterator
FindPkg(const std::string
&Name
);
222 PkgIterator
FindPkg(const std::string
&Name
, const std::string
&Arch
);
224 Header
&Head() {return *HeaderP
;}
225 inline GrpIterator
GrpBegin();
226 inline GrpIterator
GrpEnd();
227 inline PkgIterator
PkgBegin();
228 inline PkgIterator
PkgEnd();
229 inline PkgFileIterator
FileBegin();
230 inline PkgFileIterator
FileEnd();
231 inline RlsFileIterator
RlsFileBegin();
232 inline RlsFileIterator
RlsFileEnd();
234 inline bool MultiArchCache() const { return MultiArchEnabled
; }
235 inline char const * NativeArch();
237 // Make me a function
238 pkgVersioningSystem
*VS
;
241 static const char *CompTypeDeb(unsigned char Comp
) APT_CONST
;
242 static const char *CompType(unsigned char Comp
) APT_CONST
;
243 static const char *DepType(unsigned char Dep
);
245 pkgCache(MMap
*Map
,bool DoMap
= true);
250 bool MultiArchEnabled
;
251 APT_HIDDEN PkgIterator
SingleArchFindPkg(const std::string
&Name
);
254 // Header structure /*{{{*/
255 struct pkgCache::Header
257 /** \brief Signature information
259 This must contain the hex value 0x98FE76DC which is designed to
260 verify that the system loading the image has the same byte order
261 and byte size as the system saving the image */
262 unsigned long Signature
;
263 /** These contain the version of the cache file */
266 /** \brief indicates if the cache should be erased
268 Dirty is true if the cache file was opened for reading, the client
269 expects to have written things to it and have not fully synced it.
270 The file should be erased and rebuilt if it is true. */
273 /** \brief Size of structure values
275 All *Sz variables contains the sizeof() that particular structure.
276 It is used as an extra consistency check on the structure of the file.
278 If any of the size values do not exactly match what the client expects
279 then the client should refuse the load the file. */
280 unsigned short HeaderSz
;
281 unsigned short GroupSz
;
282 unsigned short PackageSz
;
283 unsigned short ReleaseFileSz
;
284 unsigned short PackageFileSz
;
285 unsigned short VersionSz
;
286 unsigned short DescriptionSz
;
287 unsigned short DependencySz
;
288 unsigned short DependencyDataSz
;
289 unsigned short ProvidesSz
;
290 unsigned short VerFileSz
;
291 unsigned short DescFileSz
;
293 /** \brief Structure counts
295 These indicate the number of each structure contained in the cache.
296 PackageCount is especially useful for generating user state structures.
297 See Package::Id for more info. */
299 map_id_t PackageCount
;
300 map_id_t VersionCount
;
301 map_id_t DescriptionCount
;
302 map_id_t DependsCount
;
303 map_id_t DependsDataCount
;
304 map_fileid_t ReleaseFileCount
;
305 map_fileid_t PackageFileCount
;
306 map_fileid_t VerFileCount
;
307 map_fileid_t DescFileCount
;
308 map_id_t ProvidesCount
;
310 /** \brief index of the first PackageFile structure
312 The PackageFile structures are singly linked lists that represent
313 all package files that have been merged into the cache. */
314 map_pointer_t FileList
;
315 /** \brief index of the first ReleaseFile structure */
316 map_pointer_t RlsFileList
;
318 /** \brief String representing the version system used */
319 map_pointer_t VerSysName
;
320 /** \brief native architecture the cache was built against */
321 map_pointer_t Architecture
;
322 /** \brief all architectures the cache was built against */
323 map_pointer_t Architectures
;
324 /** \brief The maximum size of a raw entry from the original Package file */
325 map_filesize_t MaxVerFileSize
;
326 /** \brief The maximum size of a raw entry from the original Translation file */
327 map_filesize_t MaxDescFileSize
;
329 /** \brief The Pool structures manage the allocation pools that the generator uses
331 Start indicates the first byte of the pool, Count is the number of objects
332 remaining in the pool and ItemSize is the structure size (alignment factor)
333 of the pool. An ItemSize of 0 indicates the pool is empty. There should be
334 the same number of pools as there are structure types. The generator
335 stores this information so future additions can make use of any unused pool
337 DynamicMMap::Pool Pools
[12];
339 /** \brief hash tables providing rapid group/package name lookup
341 Each group/package name is inserted into a hash table using pkgCache::Hash(const &string)
342 By iterating over each entry in the hash table it is possible to iterate over
343 the entire list of packages. Hash Collisions are handled with a singly linked
344 list of packages based at the hash item. The linked list contains only
345 packages that match the hashing function.
346 In the PkgHashTable is it possible that multiple packages have the same name -
347 these packages are stored as a sequence in the list.
348 The size of both tables is the same. */
349 unsigned int HashTableSize
;
350 unsigned int GetHashTableSize() const { return HashTableSize
; }
351 void SetHashTableSize(unsigned int const sz
) { HashTableSize
= sz
; }
352 map_pointer_t
GetArchitectures() const { return Architectures
; }
353 void SetArchitectures(map_pointer_t
const idx
) { Architectures
= idx
; }
354 map_pointer_t
* PkgHashTableP() const { return (map_pointer_t
*) (this + 1); }
355 map_pointer_t
* GrpHashTableP() const { return PkgHashTableP() + GetHashTableSize(); }
357 /** \brief Size of the complete cache file */
358 map_filesize_small_t CacheFileSize
;
360 bool CheckSizes(Header
&Against
) const APT_PURE
;
364 // Group structure /*{{{*/
365 /** \brief groups architecture depending packages together
367 On or more packages with the same name form a group, so we have
368 a simple way to access a package built for different architectures
369 Group exists in a singly linked list of group records starting at
370 the hash index of the name in the pkgCache::Header::GrpHashTable */
371 struct pkgCache::Group
373 /** \brief Name of the group */
374 map_stringitem_t Name
;
377 /** \brief Link to the first package which belongs to the group */
378 map_pointer_t FirstPackage
; // Package
379 /** \brief Link to the last package which belongs to the group */
380 map_pointer_t LastPackage
; // Package
381 /** \brief Link to the next Group */
382 map_pointer_t Next
; // Group
383 /** \brief unique sequel ID */
388 // Package structure /*{{{*/
389 /** \brief contains information for a single unique package
391 There can be any number of versions of a given package.
392 Package exists in a singly linked list of package records starting at
393 the hash index of the name in the pkgCache::Header::PkgHashTable
395 A package can be created for every architecture so package names are
396 not unique, but it is guaranteed that packages with the same name
397 are sequencel ordered in the list. Packages with the same name can be
398 accessed with the Group.
400 struct pkgCache::Package
402 /** \brief Name of the package
403 * Note that the access method Name() will remain. It is just this data member
404 * deprecated as this information is already stored and available via the
405 * associated Group – so it is wasting precious binary cache space */
406 APT_DEPRECATED map_stringitem_t Name
;
407 /** \brief Architecture of the package */
408 map_stringitem_t Arch
;
409 /** \brief Base of a singly linked list of versions
411 Each structure represents a unique version of the package.
412 The version structures contain links into PackageFile and the
413 original text file as well as detailed information about the size
414 and dependencies of the specific package. In this way multiple
415 versions of a package can be cleanly handled by the system.
416 Furthermore, this linked list is guaranteed to be sorted
417 from Highest version to lowest version with no duplicate entries. */
418 map_pointer_t VersionList
; // Version
419 /** \brief index to the installed version */
420 map_pointer_t CurrentVer
; // Version
421 /** \brief indicates nothing (consistently)
422 This field used to contain ONE section the package belongs to,
423 if those differs between versions it is a RANDOM one.
424 The Section() method tries to reproduce it, but the only sane
425 thing to do is use the Section field from the version! */
426 APT_DEPRECATED map_ptrloc Section
; // StringItem
427 /** \brief index of the group this package belongs to */
428 map_pointer_t Group
; // Group the Package belongs to
431 /** \brief Link to the next package in the same bucket */
432 map_pointer_t NextPackage
; // Package
433 /** \brief List of all dependencies on this package */
434 map_pointer_t RevDepends
; // Dependency
435 /** \brief List of all "packages" this package provide */
436 map_pointer_t ProvidesList
; // Provides
438 // Install/Remove/Purge etc
439 /** \brief state that the user wishes the package to be in */
440 unsigned char SelectedState
; // What
441 /** \brief installation state of the package
443 This should be "ok" but in case the installation failed
444 it will be different.
446 unsigned char InstState
; // Flags
447 /** \brief indicates if the package is installed */
448 unsigned char CurrentState
; // State
450 /** \brief unique sequel ID
452 ID is a unique value from 0 to Header->PackageCount assigned by the generator.
453 This allows clients to create an array of size PackageCount and use it to store
454 state information for the package map. For instance the status file emitter uses
455 this to track which packages have been emitted already. */
457 /** \brief some useful indicators of the package's state */
461 // Release File structure /*{{{*/
462 /** \brief stores information about the release files used to generate the cache
464 PackageFiles reference ReleaseFiles as we need to keep record of which
465 version belongs to which release e.g. for pinning. */
466 struct pkgCache::ReleaseFile
468 /** \brief physical disk file that this ReleaseFile represents */
469 map_stringitem_t FileName
;
470 /** \brief the release information
472 Please see the files document for a description of what the
473 release information means. */
474 map_stringitem_t Archive
;
475 map_stringitem_t Codename
;
476 map_stringitem_t Version
;
477 map_stringitem_t Origin
;
478 map_stringitem_t Label
;
479 /** \brief The site the index file was fetched from */
480 map_stringitem_t Site
;
482 /** \brief Size of the file
484 Used together with the modification time as a
485 simple check to ensure that the Packages
486 file has not been altered since Cache generation. */
488 /** \brief Modification time for the file */
491 /** @TODO document PackageFile::Flags */
495 /** \brief Link to the next ReleaseFile in the Cache */
496 map_pointer_t NextFile
;
497 /** \brief unique sequel ID */
501 // Package File structure /*{{{*/
502 /** \brief stores information about the files used to generate the cache
504 Package files are referenced by Version structures to be able to know
505 after the generation still from which Packages file includes this Version
506 as we need this information later on e.g. for pinning. */
507 struct pkgCache::PackageFile
509 /** \brief physical disk file that this PackageFile represents */
510 map_stringitem_t FileName
;
511 /** \brief the release information */
512 map_pointer_t Release
;
514 map_stringitem_t Component
;
515 map_stringitem_t Architecture
;
517 /** \brief indicates what sort of index file this is
519 @TODO enumerate at least the possible indexes */
520 map_stringitem_t IndexType
;
521 /** \brief Size of the file
523 Used together with the modification time as a
524 simple check to ensure that the Packages
525 file has not been altered since Cache generation. */
527 /** \brief Modification time for the file */
530 /** @TODO document PackageFile::Flags */
534 /** \brief Link to the next PackageFile in the Cache */
535 map_pointer_t NextFile
; // PackageFile
536 /** \brief unique sequel ID */
540 // VerFile structure /*{{{*/
541 /** \brief associates a version with a PackageFile
543 This allows a full description of all Versions in all files
544 (and hence all sources) under consideration. */
545 struct pkgCache::VerFile
547 /** \brief index of the package file that this version was found in */
548 map_pointer_t File
; // PackageFile
549 /** \brief next step in the linked list */
550 map_pointer_t NextFile
; // PkgVerFile
551 /** \brief position in the package file */
552 map_filesize_t Offset
; // File offset
553 /** @TODO document pkgCache::VerFile::Size */
557 // DescFile structure /*{{{*/
558 /** \brief associates a description with a Translation file */
559 struct pkgCache::DescFile
561 /** \brief index of the file that this description was found in */
562 map_pointer_t File
; // PackageFile
563 /** \brief next step in the linked list */
564 map_pointer_t NextFile
; // PkgVerFile
565 /** \brief position in the file */
566 map_filesize_t Offset
; // File offset
567 /** @TODO document pkgCache::DescFile::Size */
571 // Version structure /*{{{*/
572 /** \brief information for a single version of a package
574 The version list is always sorted from highest version to lowest
575 version by the generator. Equal version numbers are either merged
576 or handled as separate versions based on the Hash value. */
577 struct pkgCache::Version
579 /** \brief complete version string */
580 map_stringitem_t VerStr
;
581 /** \brief section this version is filled in */
582 map_stringitem_t Section
;
583 /** \brief source package name this version comes from
584 Always contains the name, even if it is the same as the binary name */
585 map_stringitem_t SourcePkgName
;
586 /** \brief source version this version comes from
587 Always contains the version string, even if it is the same as the binary version */
588 map_stringitem_t SourceVerStr
;
590 /** \brief Multi-Arch capabilities of a package version */
591 enum VerMultiArch
{ None
= 0, /*!< is the default and doesn't trigger special behaviour */
592 All
= (1<<0), /*!< will cause that Ver.Arch() will report "all" */
593 Foreign
= (1<<1), /*!< can satisfy dependencies in another architecture */
594 Same
= (1<<2), /*!< can be co-installed with itself from other architectures */
595 Allowed
= (1<<3), /*!< other packages are allowed to depend on thispkg:any */
596 AllForeign
= All
| Foreign
,
597 AllAllowed
= All
| Allowed
};
598 /** \brief stores the MultiArch capabilities of this version
600 Flags used are defined in pkgCache::Version::VerMultiArch
602 unsigned char MultiArch
;
604 /** \brief references all the PackageFile's that this version came from
606 FileList can be used to determine what distribution(s) the Version
607 applies to. If FileList is 0 then this is a blank version.
608 The structure should also have a 0 in all other fields excluding
609 pkgCache::Version::VerStr and Possibly pkgCache::Version::NextVer. */
610 map_pointer_t FileList
; // VerFile
611 /** \brief next (lower or equal) version in the linked list */
612 map_pointer_t NextVer
; // Version
613 /** \brief next description in the linked list */
614 map_pointer_t DescriptionList
; // Description
615 /** \brief base of the dependency list */
616 map_pointer_t DependsList
; // Dependency
617 /** \brief links to the owning package
619 This allows reverse dependencies to determine the package */
620 map_pointer_t ParentPkg
; // Package
621 /** \brief list of pkgCache::Provides */
622 map_pointer_t ProvidesList
; // Provides
624 /** \brief archive size for this version
626 For Debian this is the size of the .deb file. */
627 map_filesize_t Size
; // These are the .deb size
628 /** \brief uncompressed size for this version */
629 map_filesize_t InstalledSize
;
630 /** \brief characteristic value representing this version
632 No two packages in existence should have the same VerStr
633 and Hash with different contents. */
635 /** \brief unique sequel ID */
637 /** \brief parsed priority value */
638 unsigned char Priority
;
641 // Description structure /*{{{*/
642 /** \brief datamember of a linked list of available description for a version */
643 struct pkgCache::Description
645 /** \brief Language code of this description (translation)
647 If the value has a 0 length then this is read using the Package
648 file else the Translation-CODE file is used. */
649 map_stringitem_t language_code
;
650 /** \brief MD5sum of the original description
652 Used to map Translations of a description to a version
653 and to check that the Translation is up-to-date. */
654 map_stringitem_t md5sum
;
656 /** @TODO document pkgCache::Description::FileList */
657 map_pointer_t FileList
; // DescFile
658 /** \brief next translation for this description */
659 map_pointer_t NextDesc
; // Description
660 /** \brief the text is a description of this package */
661 map_pointer_t ParentPkg
; // Package
663 /** \brief unique sequel ID */
667 // Dependency structure /*{{{*/
668 /** \brief information for a single dependency record
670 The records are split up like this to ease processing by the client.
671 The base of the linked list is pkgCache::Version::DependsList.
672 All forms of dependencies are recorded here including Depends,
673 Recommends, Suggests, Enhances, Conflicts, Replaces and Breaks. */
674 struct pkgCache::DependencyData
676 /** \brief string of the version the dependency is applied against */
677 map_stringitem_t Version
;
678 /** \brief index of the package this depends applies to
680 The generator will - if the package does not already exist -
681 create a blank (no version records) package. */
682 map_pointer_t Package
; // Package
684 /** \brief Dependency type - Depends, Recommends, Conflicts, etc */
686 /** \brief comparison operator specified on the depends line
688 If the high bit is set then it is a logical OR with the previous record. */
689 unsigned char CompareOp
;
691 map_pointer_t NextData
;
693 struct pkgCache::Dependency
695 map_pointer_t DependencyData
; // DependencyData
696 /** \brief version of the package which has the depends */
697 map_pointer_t ParentVer
; // Version
698 /** \brief next reverse dependency of this package */
699 map_pointer_t NextRevDepends
; // Dependency
700 /** \brief next dependency of this version */
701 map_pointer_t NextDepends
; // Dependency
703 /** \brief unique sequel ID */
707 // Provides structure /*{{{*/
708 /** \brief handles virtual packages
710 When a Provides: line is encountered a new provides record is added
711 associating the package with a virtual package name.
712 The provides structures are linked off the package structures.
713 This simplifies the analysis of dependencies and other aspects A provides
714 refers to a specific version of a specific package, not all versions need to
715 provide that provides.*/
716 struct pkgCache::Provides
718 /** \brief index of the package providing this */
719 map_pointer_t ParentPkg
; // Package
720 /** \brief index of the version this provide line applies to */
721 map_pointer_t Version
; // Version
722 /** \brief version in the provides line (if any)
724 This version allows dependencies to depend on specific versions of a
725 Provides, as well as allowing Provides to override existing packages.
726 This is experimental. Note that Debian doesn't allow versioned provides */
727 map_stringitem_t ProvideVersion
;
728 /** \brief next provides (based of package) */
729 map_pointer_t NextProvides
; // Provides
730 /** \brief next provides (based of version) */
731 map_pointer_t NextPkgProv
; // Provides
734 // UNUSED StringItem structure /*{{{*/
735 struct APT_DEPRECATED
pkgCache::StringItem
737 /** \brief string this refers to */
738 map_ptrloc String
; // StringItem
739 /** \brief Next link in the chain */
740 map_ptrloc NextItem
; // StringItem
744 inline char const * pkgCache::NativeArch()
745 { return StrP
+ HeaderP
->Architecture
; }
747 #include <apt-pkg/cacheiterators.h>
749 inline pkgCache::GrpIterator
pkgCache::GrpBegin()
750 {return GrpIterator(*this);}
751 inline pkgCache::GrpIterator
pkgCache::GrpEnd()
752 {return GrpIterator(*this,GrpP
);}
753 inline pkgCache::PkgIterator
pkgCache::PkgBegin()
754 {return PkgIterator(*this);}
755 inline pkgCache::PkgIterator
pkgCache::PkgEnd()
756 {return PkgIterator(*this,PkgP
);}
757 inline pkgCache::PkgFileIterator
pkgCache::FileBegin()
758 {return PkgFileIterator(*this,PkgFileP
+ HeaderP
->FileList
);}
759 inline pkgCache::PkgFileIterator
pkgCache::FileEnd()
760 {return PkgFileIterator(*this,PkgFileP
);}
761 inline pkgCache::RlsFileIterator
pkgCache::RlsFileBegin()
762 {return RlsFileIterator(*this,RlsFileP
+ HeaderP
->RlsFileList
);}
763 inline pkgCache::RlsFileIterator
pkgCache::RlsFileEnd()
764 {return RlsFileIterator(*this,RlsFileP
);}
767 // Oh I wish for Real Name Space Support
768 class pkgCache::Namespace
/*{{{*/
771 typedef pkgCache::GrpIterator GrpIterator
;
772 typedef pkgCache::PkgIterator PkgIterator
;
773 typedef pkgCache::VerIterator VerIterator
;
774 typedef pkgCache::DescIterator DescIterator
;
775 typedef pkgCache::DepIterator DepIterator
;
776 typedef pkgCache::PrvIterator PrvIterator
;
777 typedef pkgCache::RlsFileIterator RlsFileIterator
;
778 typedef pkgCache::PkgFileIterator PkgFileIterator
;
779 typedef pkgCache::VerFileIterator VerFileIterator
;
780 typedef pkgCache::Version Version
;
781 typedef pkgCache::Description Description
;
782 typedef pkgCache::Package Package
;
783 typedef pkgCache::Header Header
;
784 typedef pkgCache::Dep Dep
;
785 typedef pkgCache::Flag Flag
;