From 384cfa1fe9dfd30b35d6f8b0ae87be643ab75d06 Mon Sep 17 00:00:00 2001 From: наб Date: Thu, 23 Jan 2025 20:37:35 +0100 Subject: Return string_view from Apt::String::Strip(). Take string_view in VectorizeString(), StringSplit(), SubstVar() --- apt-pkg/contrib/strutl.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg/contrib/strutl.h') diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 7e6aba272..92df7c9d3 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -42,7 +42,7 @@ namespace { namespace APT { namespace String { - APT_PUBLIC std::string Strip(std::string_view s); + APT_PUBLIC std::string_view Strip(std::string_view s); APT_PUBLIC bool Endswith(const std::string_view &s, const std::string_view &ending); APT_PUBLIC bool Startswith(const std::string_view &s, const std::string_view &starting); APT_PUBLIC std::string Join(std::vector list, const std::string_view &sep); @@ -111,7 +111,7 @@ APT_PUBLIC bool TokSplitString(char Tok,char *Input,char **List, unsigned long ListMax); // split a given string by a char -APT_PUBLIC std::vector VectorizeString(std::string const &haystack, char const &split) APT_PURE; +APT_PUBLIC std::vector VectorizeString(std::string_view const &haystack, char const &split) APT_PURE; /* \brief Return a vector of strings from string "input" where "sep" * is used as the delimiter string. @@ -127,8 +127,8 @@ APT_PUBLIC std::vector VectorizeString(std::string const &haystack, * if used the string is only split on maxsplit places and the last * item in the vector contains the remainder string. */ -APT_PUBLIC std::vector StringSplit(std::string const &input, - std::string const &sep, +APT_PUBLIC std::vector StringSplit(std::string_view const &input, + std::string_view const &sep, unsigned int maxsplit=std::numeric_limits::max()) APT_PURE; @@ -248,7 +248,7 @@ struct SubstVar const std::string *Contents; }; APT_PUBLIC std::string SubstVar(std::string Str,const struct SubstVar *Vars); -APT_PUBLIC std::string SubstVar(const std::string &Str,const std::string &Subst,const std::string &Contents); +APT_PUBLIC std::string SubstVar(const std::string_view &Str,const std::string_view &Subst,const std::string_view &Contents); struct RxChoiceList { -- cgit v1.2.3-70-g09d2