X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/55153bf94ff28a23318e79aa48242244c4d82b3c..cb9ac09bd6a36e73c2dce1d529acde6e4d15e32d:/apt-pkg/tagfile.h diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 2f26846ef..0f4c15436 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -27,6 +27,9 @@ #include #include #include +#ifdef APT_PKG_EXPOSE_STRING_VIEW +#include +#endif #ifndef APT_8_CLEANER_HEADERS #include @@ -58,19 +61,40 @@ class pkgTagSection inline bool operator ==(const pkgTagSection &rhs) {return Section == rhs.Section;}; inline bool operator !=(const pkgTagSection &rhs) {return Section != rhs.Section;}; +#if !defined(APT_PKG_EXPOSE_STRING_VIEW) || defined(APT_COMPILING_TAGFILE_COMPAT_CC) bool Find(const char *Tag,const char *&Start, const char *&End) const; bool Find(const char *Tag,unsigned int &Pos) const; - std::string FindS(const char *Tag) const; - std::string FindRawS(const char *Tag) const; signed int FindI(const char *Tag,signed long Default = 0) const; bool FindB(const char *Tag, bool const &Default = false) const; unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const; bool FindFlag(const char * const Tag,uint8_t &Flags, uint8_t const Flag) const; - bool static FindFlag(uint8_t &Flags, uint8_t const Flag, - const char* const Start, const char* const Stop); bool FindFlag(const char *Tag,unsigned long &Flags, unsigned long Flag) const; + bool Exists(const char* const Tag) const; +#endif + // TODO: Remove internally + std::string FindS(const char *Tag) const; + std::string FindRawS(const char *Tag) const; + +#ifdef APT_PKG_EXPOSE_STRING_VIEW + 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; + APT_HIDDEN APT::StringView FindRaw(APT::StringView Tag) const; + APT_HIDDEN signed int FindI(APT::StringView Tag,signed long Default = 0) const; + APT_HIDDEN bool FindB(APT::StringView, bool Default = false) const; + APT_HIDDEN unsigned long long FindULL(APT::StringView Tag, unsigned long long const &Default = 0) const; + + APT_HIDDEN bool FindFlag(APT::StringView Tag,uint8_t &Flags, + uint8_t const Flag) const; + APT_HIDDEN bool FindFlag(APT::StringView Tag,unsigned long &Flags, + unsigned long Flag) const; + APT_HIDDEN bool Exists(APT::StringView Tag) const; +#endif + + bool static FindFlag(uint8_t &Flags, uint8_t const Flag, + const char* const Start, const char* const Stop); bool static FindFlag(unsigned long &Flags, unsigned long Flag, const char* Start, const char* Stop); @@ -102,7 +126,6 @@ class pkgTagSection * times, but only the last occurrence is available via Find methods. */ unsigned int Count() const; - bool Exists(const char* const Tag) const; void Get(const char *&Start,const char *&Stop,unsigned int I) const; @@ -140,9 +163,7 @@ class pkgTagSection }; -/* For user generated file the parser should be a bit more relaxed in exchange - for being a bit slower to allow comments and new lines all over the place */ -class pkgUserTagSection : public pkgTagSection +class APT_DEPRECATED_MSG("Use pkgTagFile with the SUPPORT_COMMENTS flag instead") pkgUserTagSection : public pkgTagSection { virtual void TrimRecord(bool BeforeRecord, const char* &End) APT_OVERRIDE; };