From abfd07702c1bbc3ed489d015b43db58ab677af0c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 27 Sep 2016 17:32:24 +0200 Subject: TagSection: Introduce functions for looking up by key ids Introduce a new enum class and add functions that can do a lookup with that enum class. This uses triehash. --- apt-pkg/tagfile.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'apt-pkg/tagfile.h') diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index cdca54756..3b89d0e45 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -89,7 +89,19 @@ class pkgTagSection std::string FindS(const char *Tag) const; std::string FindRawS(const char *Tag) const; + // Functions for lookup with a perfect hash function + enum class Key; + APT_HIDDEN bool Find(Key key,const char *&Start, const char *&End) const; + APT_HIDDEN bool Find(Key key,unsigned int &Pos) const; + APT_HIDDEN signed int FindI(Key key,signed long Default = 0) const; + APT_HIDDEN bool FindB(Key key, bool Default = false) const; + APT_HIDDEN unsigned long long FindULL(Key key, unsigned long long const &Default = 0) const; + APT_HIDDEN bool FindFlag(Key key,uint8_t &Flags, uint8_t const Flag) const; + APT_HIDDEN bool FindFlag(Key key,unsigned long &Flags, unsigned long Flag) const; + APT_HIDDEN bool Exists(Key key) const; #ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN APT::StringView Find(Key key) const; + APT_HIDDEN APT::StringView FindRaw(Key key) const; APT_HIDDEN bool Find(APT::StringView Tag,const char *&Start, const char *&End) const; APT_HIDDEN bool Find(APT::StringView Tag,unsigned int &Pos) const; APT_HIDDEN APT::StringView Find(APT::StringView Tag) const; -- cgit v1.2.3