X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/453b82a388013e522b3a1b9fcd6ed0810dab1f4f..cc9745a0d81a3e1aa5ef6f99f7ad638d26bdb950:/apt-pkg/contrib/hashsum_template.h diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h index 869dc5cb7..4000f230d 100644 --- a/apt-pkg/contrib/hashsum_template.h +++ b/apt-pkg/contrib/hashsum_template.h @@ -13,6 +13,9 @@ #include #include +#ifdef APT_PKG_EXPOSE_STRING_VIEW +#include +#endif #include @@ -76,22 +79,40 @@ class HashSumValue return Value(); } +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN bool Set(APT::StringView Str) + { + return Hex2Num(Str,Sum,sizeof(Sum)); + } +#else bool Set(std::string Str) { return Hex2Num(Str,Sum,sizeof(Sum)); } - +#endif inline void Set(unsigned char S[N/8]) { for (int I = 0; I != sizeof(Sum); ++I) Sum[I] = S[I]; } - HashSumValue(std::string Str) + explicit HashSumValue(std::string const &Str) { memset(Sum,0,sizeof(Sum)); Set(Str); } +#ifdef APT_PKG_EXPOSE_STRING_VIEW + APT_HIDDEN explicit HashSumValue(APT::StringView const &Str) + { + memset(Sum,0,sizeof(Sum)); + Set(Str); + } + APT_HIDDEN explicit HashSumValue(const char *Str) + { + memset(Sum,0,sizeof(Sum)); + Set(Str); + } +#endif HashSumValue() { memset(Sum,0,sizeof(Sum));