X-Git-Url: http://git.hcoop.net/ntk/apt.git/blobdiff_plain/ea38b1e608db857d4845b7bf6275b2df1fb8c9e7..4cd4a2e7033a2af214be1d830b56fab719088b7a:/apt-pkg/pkgcache.h diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 82a69b2c..5e8a9630 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -74,13 +74,16 @@ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H +#include +#include #include #include -#include +#ifndef APT_8_CLEANER_HEADERS using std::string; - +#endif + class pkgVersioningSystem; class pkgCache /*{{{*/ { @@ -152,11 +155,11 @@ class pkgCache /*{{{*/ protected: // Memory mapped cache file - string CacheFile; + std::string CacheFile; MMap ⤅ - unsigned long sHash(const string &S) const; - unsigned long sHash(const char *S) const; + unsigned long sHash(const std::string &S) const APT_PURE; + unsigned long sHash(const char *S) const APT_PURE; public: @@ -175,23 +178,23 @@ class pkgCache /*{{{*/ char *StrP; virtual bool ReMap(bool const &Errorchecks = true); - inline bool Sync() {return Map.Sync();}; - inline MMap &GetMap() {return Map;}; - inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}; + inline bool Sync() {return Map.Sync();} + inline MMap &GetMap() {return Map;} + inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();} // String hashing function (512 range) - inline unsigned long Hash(const string &S) const {return sHash(S);}; - inline unsigned long Hash(const char *S) const {return sHash(S);}; + inline unsigned long Hash(const std::string &S) const {return sHash(S);} + inline unsigned long Hash(const char *S) const {return sHash(S);} // Useful transformation things const char *Priority(unsigned char Priority); // Accessors - GrpIterator FindGrp(const string &Name); - PkgIterator FindPkg(const string &Name); - PkgIterator FindPkg(const string &Name, const string &Arch); + GrpIterator FindGrp(const std::string &Name); + PkgIterator FindPkg(const std::string &Name); + PkgIterator FindPkg(const std::string &Name, const std::string &Arch); - Header &Head() {return *HeaderP;}; + Header &Head() {return *HeaderP;} inline GrpIterator GrpBegin(); inline GrpIterator GrpEnd(); inline PkgIterator PkgBegin(); @@ -199,22 +202,23 @@ class pkgCache /*{{{*/ inline PkgFileIterator FileBegin(); inline PkgFileIterator FileEnd(); - inline bool MultiArchCache() const { return MultiArchEnabled; }; + inline bool MultiArchCache() const { return MultiArchEnabled; } + inline char const * NativeArch(); // Make me a function pkgVersioningSystem *VS; // Converters - static const char *CompTypeDeb(unsigned char Comp); - static const char *CompType(unsigned char Comp); + static const char *CompTypeDeb(unsigned char Comp) APT_CONST; + static const char *CompType(unsigned char Comp) APT_CONST; static const char *DepType(unsigned char Dep); pkgCache(MMap *Map,bool DoMap = true); - virtual ~pkgCache() {}; + virtual ~pkgCache() {} private: bool MultiArchEnabled; - PkgIterator SingleArchFindPkg(const string &Name); + PkgIterator SingleArchFindPkg(const std::string &Name); }; /*}}}*/ // Header structure /*{{{*/ @@ -313,7 +317,10 @@ struct pkgCache::Header map_ptrloc PkgHashTable[2*1048]; map_ptrloc GrpHashTable[2*1048]; - bool CheckSizes(Header &Against) const; + /** \brief Size of the complete cache file */ + unsigned long CacheFileSize; + + bool CheckSizes(Header &Against) const APT_PURE; Header(); }; /*}}}*/ @@ -349,7 +356,7 @@ struct pkgCache::Group the hash index of the name in the pkgCache::Header::PkgHashTable A package can be created for every architecture so package names are - not unique, but it is garanteed that packages with the same name + not unique, but it is guaranteed that packages with the same name are sequencel ordered in the list. Packages with the same name can be accessed with the Group. */ @@ -446,7 +453,7 @@ struct pkgCache::PackageFile /** \brief Modification time for the file */ time_t mtime; - /* @TODO document PackageFile::Flags */ + /** @TODO document PackageFile::Flags */ unsigned long Flags; // Linked list @@ -469,7 +476,7 @@ struct pkgCache::VerFile map_ptrloc NextFile; // PkgVerFile /** \brief position in the package file */ map_ptrloc Offset; // File offset - /* @TODO document pkgCache::VerFile::Size */ + /** @TODO document pkgCache::VerFile::Size */ unsigned long Size; }; /*}}}*/ @@ -483,7 +490,7 @@ struct pkgCache::DescFile map_ptrloc NextFile; // PkgVerFile /** \brief position in the file */ map_ptrloc Offset; // File offset - /* @TODO document pkgCache::DescFile::Size */ + /** @TODO document pkgCache::DescFile::Size */ unsigned long Size; }; /*}}}*/ @@ -499,15 +506,20 @@ struct pkgCache::Version map_ptrloc VerStr; // StringItem /** \brief section this version is filled in */ map_ptrloc Section; // StringItem + + /** \brief Multi-Arch capabilities of a package version */ + enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger special behaviour */ + All = (1<<0), /*!< will cause that Ver.Arch() will report "all" */ + Foreign = (1<<1), /*!< can satisfy dependencies in another architecture */ + Same = (1<<2), /*!< can be co-installed with itself from other architectures */ + Allowed = (1<<3), /*!< other packages are allowed to depend on thispkg:any */ + AllForeign = All | Foreign, + AllAllowed = All | Allowed }; /** \brief stores the MultiArch capabilities of this version - None is the default and doesn't trigger special behaviour, - Foreign means that this version can fulfill dependencies even - if it is built for another architecture as the requester. - Same indicates that builds for different architectures can - be co-installed on the system and All is the marker for a - version with the Architecture: all. */ - enum {None, All, Foreign, Same, Allowed} MultiArch; + Flags used are defined in pkgCache::Version::VerMultiArch + */ + unsigned char MultiArch; /** \brief references all the PackageFile's that this version came from @@ -561,7 +573,7 @@ struct pkgCache::Description and to check that the Translation is up-to-date. */ map_ptrloc md5sum; // StringItem - /* @TODO document pkgCache::Description::FileList */ + /** @TODO document pkgCache::Description::FileList */ map_ptrloc FileList; // DescFile /** \brief next translation for this description */ map_ptrloc NextDesc; // Description @@ -649,24 +661,29 @@ struct pkgCache::StringItem map_ptrloc NextItem; // StringItem }; /*}}}*/ + + +inline char const * pkgCache::NativeArch() + { return StrP + HeaderP->Architecture; } + #include -inline pkgCache::GrpIterator pkgCache::GrpBegin() - {return GrpIterator(*this);}; -inline pkgCache::GrpIterator pkgCache::GrpEnd() - {return GrpIterator(*this,GrpP);}; -inline pkgCache::PkgIterator pkgCache::PkgBegin() - {return PkgIterator(*this);}; -inline pkgCache::PkgIterator pkgCache::PkgEnd() - {return PkgIterator(*this,PkgP);}; +inline pkgCache::GrpIterator pkgCache::GrpBegin() + {return GrpIterator(*this);} +inline pkgCache::GrpIterator pkgCache::GrpEnd() + {return GrpIterator(*this,GrpP);} +inline pkgCache::PkgIterator pkgCache::PkgBegin() + {return PkgIterator(*this);} +inline pkgCache::PkgIterator pkgCache::PkgEnd() + {return PkgIterator(*this,PkgP);} inline pkgCache::PkgFileIterator pkgCache::FileBegin() - {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);}; + {return PkgFileIterator(*this,PkgFileP + HeaderP->FileList);} inline pkgCache::PkgFileIterator pkgCache::FileEnd() - {return PkgFileIterator(*this,PkgFileP);}; + {return PkgFileIterator(*this,PkgFileP);} // Oh I wish for Real Name Space Support class pkgCache::Namespace /*{{{*/ -{ +{ public: typedef pkgCache::GrpIterator GrpIterator; typedef pkgCache::PkgIterator PkgIterator; @@ -675,7 +692,7 @@ class pkgCache::Namespace /*{{{*/ typedef pkgCache::DepIterator DepIterator; typedef pkgCache::PrvIterator PrvIterator; typedef pkgCache::PkgFileIterator PkgFileIterator; - typedef pkgCache::VerFileIterator VerFileIterator; + typedef pkgCache::VerFileIterator VerFileIterator; typedef pkgCache::Version Version; typedef pkgCache::Description Description; typedef pkgCache::Package Package;