Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
strings.hh
1#pragma once
2
3#include <list>
4#include <set>
5#include <string_view>
6#include <string>
7#include <vector>
8
9namespace nix {
10
11/*
12 * workaround for unavailable view() method (C++20) of std::ostringstream under MacOS with clang-16
13 */
14std::string_view toView(const std::ostringstream & os);
15
21template<class C, class CharT = char>
22C basicTokenizeString(std::basic_string_view<CharT> s, std::basic_string_view<CharT> separators);
23
27template<class C>
28C tokenizeString(std::string_view s, std::string_view separators = " \t\n\r");
29
30extern template std::list<std::string> tokenizeString(std::string_view s, std::string_view separators);
31extern template std::set<std::string> tokenizeString(std::string_view s, std::string_view separators);
32extern template std::vector<std::string> tokenizeString(std::string_view s, std::string_view separators);
33
39template<class C, class CharT = char>
40C basicSplitString(std::basic_string_view<CharT> s, std::basic_string_view<CharT> separators);
41template<typename C>
42C splitString(std::string_view s, std::string_view separators);
43
44extern template std::list<std::string> splitString(std::string_view s, std::string_view separators);
45extern template std::set<std::string> splitString(std::string_view s, std::string_view separators);
46extern template std::vector<std::string> splitString(std::string_view s, std::string_view separators);
47
51template<class C>
52std::string concatStringsSep(const std::string_view sep, const C & ss);
53
54extern template std::string concatStringsSep(std::string_view, const std::list<std::string> &);
55extern template std::string concatStringsSep(std::string_view, const std::set<std::string> &);
56extern template std::string concatStringsSep(std::string_view, const std::vector<std::string> &);
57
65template<class C>
66[[deprecated(
67 "Consider removing the empty string dropping behavior. If acceptable, use concatStringsSep instead.")]] std::string
68dropEmptyInitThenConcatStringsSep(const std::string_view sep, const C & ss);
69
70extern template std::string dropEmptyInitThenConcatStringsSep(std::string_view, const std::list<std::string> &);
71extern template std::string dropEmptyInitThenConcatStringsSep(std::string_view, const std::set<std::string> &);
72extern template std::string dropEmptyInitThenConcatStringsSep(std::string_view, const std::vector<std::string> &);
73
80std::list<std::string> shellSplitString(std::string_view s);
81}
return s
Definition lexer.l:459