1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 16:31:47 +02:00

Refactor: rename C++ concatStringsSep -> dropEmptyInitThenConcatStringsSep

This commit is contained in:
Robert Hensing 2024-07-12 22:09:27 +02:00
parent b1effc9649
commit 1a8defd06f
33 changed files with 70 additions and 70 deletions

View file

@ -152,7 +152,7 @@ static void parseConfigFiles(const std::string & contents, const std::string & p
parsedContents.push_back({
std::move(name),
concatStringsSep(" ", Strings(i, tokens.end())),
dropEmptyInitThenConcatStringsSep(" ", Strings(i, tokens.end())),
});
};
}
@ -318,7 +318,7 @@ template<> void BaseSetting<Strings>::appendOrSet(Strings newValue, bool append)
template<> std::string BaseSetting<Strings>::to_string() const
{
return concatStringsSep(" ", value);
return dropEmptyInitThenConcatStringsSep(" ", value);
}
template<> StringSet BaseSetting<StringSet>::parse(const std::string & str) const
@ -334,7 +334,7 @@ template<> void BaseSetting<StringSet>::appendOrSet(StringSet newValue, bool app
template<> std::string BaseSetting<StringSet>::to_string() const
{
return concatStringsSep(" ", value);
return dropEmptyInitThenConcatStringsSep(" ", value);
}
template<> std::set<ExperimentalFeature> BaseSetting<std::set<ExperimentalFeature>>::parse(const std::string & str) const
@ -362,7 +362,7 @@ template<> std::string BaseSetting<std::set<ExperimentalFeature>>::to_string() c
StringSet stringifiedXpFeatures;
for (const auto & feature : value)
stringifiedXpFeatures.insert(std::string(showExperimentalFeature(feature)));
return concatStringsSep(" ", stringifiedXpFeatures);
return dropEmptyInitThenConcatStringsSep(" ", stringifiedXpFeatures);
}
template<> StringMap BaseSetting<StringMap>::parse(const std::string & str) const

View file

@ -37,7 +37,7 @@ template<class C> C tokenizeString(std::string_view s, std::string_view separato
* elements.
*/
template<class C>
std::string concatStringsSep(const std::string_view sep, const C & ss)
std::string dropEmptyInitThenConcatStringsSep(const std::string_view sep, const C & ss)
{
size_t size = 0;
// need a cast to string_view since this is also called with Symbols
@ -56,7 +56,7 @@ auto concatStrings(Parts && ... parts)
-> std::enable_if_t<(... && std::is_convertible_v<Parts, std::string_view>), std::string>
{
std::string_view views[sizeof...(parts)] = { parts... };
return concatStringsSep({}, views);
return dropEmptyInitThenConcatStringsSep({}, views);
}