X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/ebc5b43cca0a16e3f552130db9233fa14b313739..b1bdfe682054ea6fc202416968c5342d59b403b1:/apt-pkg/pkgcache.h diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 801f8556d..91228f713 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -81,6 +81,10 @@ #include #include +#ifdef APT_PKG_EXPOSE_STRING_VIEW +#include +#endif + #ifndef APT_8_CLEANER_HEADERS using std::string; #endif @@ -193,7 +197,9 @@ class pkgCache /*{{{*/ // Memory mapped cache file std::string CacheFile; MMap ⤅ - +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN map_id_t sHash(APT::StringView S) const APT_PURE; +#endif map_id_t sHash(const std::string &S) const APT_PURE; map_id_t sHash(const char *S) const APT_PURE; @@ -212,7 +218,7 @@ class pkgCache /*{{{*/ Provides *ProvideP; Dependency *DepP; DependencyData *DepDataP; - APT_DEPRECATED StringItem *StringItemP; + APT_DEPRECATED_MSG("Not used anymore in cache generation and without a replacement") StringItem *StringItemP; char *StrP; virtual bool ReMap(bool const &Errorchecks = true); @@ -221,13 +227,34 @@ class pkgCache /*{{{*/ inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();} // String hashing function (512 range) +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN inline map_id_t Hash(APT::StringView S) const {return sHash(S);} +#endif inline map_id_t Hash(const std::string &S) const {return sHash(S);} inline map_id_t Hash(const char *S) const {return sHash(S);} + APT_HIDDEN uint32_t CacheHash(); + // Useful transformation things static const char *Priority(unsigned char Priority); // Accessors +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN GrpIterator FindGrp(APT::StringView Name); + APT_HIDDEN PkgIterator FindPkg(APT::StringView Name); + APT_HIDDEN PkgIterator FindPkg(APT::StringView Name, APT::StringView Arch); +#endif + +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT::StringView ViewString(map_stringitem_t idx) const + { + char *name = StrP + idx; + uint16_t len = *reinterpret_cast(name - sizeof(uint16_t)); + return APT::StringView(name, len); + } +#endif + + GrpIterator FindGrp(const std::string &Name); PkgIterator FindPkg(const std::string &Name); PkgIterator FindPkg(const std::string &Name, const std::string &Arch); @@ -259,7 +286,6 @@ class pkgCache /*{{{*/ private: void * const d; bool MultiArchEnabled; - APT_HIDDEN PkgIterator SingleArchFindPkg(const std::string &Name); }; /*}}}*/ // Header structure /*{{{*/ @@ -365,7 +391,7 @@ struct pkgCache::Header map_pointer_t * PkgHashTableP() const { return (map_pointer_t*) (this + 1); } map_pointer_t * GrpHashTableP() const { return PkgHashTableP() + GetHashTableSize(); } - /** \brief Size of the complete cache file */ + /** \brief Hash of the file (TODO: Rename) */ map_filesize_small_t CacheFileSize; bool CheckSizes(Header &Against) const APT_PURE; @@ -414,7 +440,7 @@ struct pkgCache::Package * Note that the access method Name() will remain. It is just this data member * deprecated as this information is already stored and available via the * associated Group – so it is wasting precious binary cache space */ - APT_DEPRECATED map_stringitem_t Name; + APT_DEPRECATED_MSG("Use the .Name() method instead of accessing the member directly") map_stringitem_t Name; /** \brief Architecture of the package */ map_stringitem_t Arch; /** \brief Base of a singly linked list of versions @@ -579,6 +605,7 @@ struct pkgCache::DescFile The version list is always sorted from highest version to lowest version by the generator. Equal version numbers are either merged or handled as separate versions based on the Hash value. */ +APT_IGNORE_DEPRECATED_PUSH struct pkgCache::Version { /** \brief complete version string */ @@ -602,7 +629,7 @@ struct pkgCache::Version AllAllowed = All | Allowed }; /** \brief deprecated variant of No */ - static const APT_DEPRECATED VerMultiArch None = No; + static const APT_DEPRECATED_MSG("The default value of the Multi-Arch field is no, not none") VerMultiArch None = No; /** \brief stores the MultiArch capabilities of this version @@ -646,6 +673,7 @@ struct pkgCache::Version /** \brief parsed priority value */ map_number_t Priority; }; +APT_IGNORE_DEPRECATED_POP /*}}}*/ // Description structure /*{{{*/ /** \brief datamember of a linked list of available description for a version */ @@ -741,7 +769,7 @@ struct pkgCache::Provides }; /*}}}*/ // UNUSED StringItem structure /*{{{*/ -struct APT_DEPRECATED pkgCache::StringItem +struct APT_DEPRECATED_MSG("No longer used in cache generation without a replacement") pkgCache::StringItem { /** \brief string this refers to */ map_ptrloc String; // StringItem