1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-03 22:51:47 +02:00

Split tests, organize more string functions

The test split matches PR #8920, so the utility files and tests files
are once again to 1-1. The string changes continues what was started in
PR #11093.
This commit is contained in:
John Ericson 2024-08-05 12:34:05 -04:00
parent 1fce591cbc
commit 9d2d4d11e6
13 changed files with 959 additions and 766 deletions

View file

@ -53,24 +53,6 @@ std::vector<char *> stringsToCharPtrs(const Strings & ss)
//////////////////////////////////////////////////////////////////////
template<class C> C tokenizeString(std::string_view s, std::string_view separators)
{
C result;
auto pos = s.find_first_not_of(separators, 0);
while (pos != s.npos) {
auto end = s.find_first_of(separators, pos + 1);
if (end == s.npos) end = s.size();
result.insert(result.end(), std::string(s, pos, end - pos));
pos = s.find_first_not_of(separators, end);
}
return result;
}
template Strings tokenizeString(std::string_view s, std::string_view separators);
template StringSet tokenizeString(std::string_view s, std::string_view separators);
template std::vector<std::string> tokenizeString(std::string_view s, std::string_view separators);
std::string chomp(std::string_view s)
{
size_t i = s.find_last_not_of(" \n\r\t");