|
Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
|
#include "lix/libutil/error.hh"#include "lix/libutil/types.hh"#include <vector>#include <boost/container/small_vector.hpp>Go to the source code of this file.
Classes | |
| class | nix::Rewriter |
Functions | |
| std::vector< char * > | nix::stringsToCharPtrs (const Strings &ss) |
| nix::MakeError (FormatError, Error) | |
| template<class C> | |
| C | nix::tokenizeString (std::string_view s, std::string_view separators) |
| template<class C> | |
| std::string | nix::concatStringsSep (const std::string_view sep, const C &ss) |
| template<class ... Parts> | |
| auto | nix::concatStrings (Parts &&... parts) -> std::enable_if_t<(... &&std::is_convertible_v< Parts, std::string_view >), std::string > |
| template<class C, class F> | |
| std::string | nix::concatMapStringsSep (std::string_view separator, const C &iterable, F fn) |
| template<class C> | |
| Strings | nix::quoteStrings (const C &c) |
| std::string | nix::chomp (std::string_view s) |
| std::string | nix::trim (std::string_view s, std::string_view whitespace) |
| std::string | nix::replaceStrings (std::string res, std::string_view from, std::string_view to) |
| std::string | nix::rewriteStrings (std::string s, const StringMap &rewrites) |
| template<class N> | |
| std::optional< N > | nix::string2Int (const std::string_view s) |
| template<class N> | |
| N | nix::string2IntWithUnitPrefix (std::string_view s) |
| template<class N> | |
| std::optional< N > | nix::string2Float (const std::string_view s) |
| std::string | nix::toLower (const std::string &s) |
| std::string | nix::shellEscape (const std::string_view s) |
| std::string | nix::base64Encode (std::string_view s) |
| std::string | nix::base64Decode (std::string_view s) |
| std::string | nix::stripIndentation (std::string_view s) |
| std::pair< std::string_view, std::string_view > | nix::getLine (std::string_view s) |
| std::string | nix::showBytes (uint64_t bytes) |
| std::string | nix::operator+ (const std::string &s1, std::string_view s2) |
| std::string | nix::operator+ (std::string &&s, std::string_view s2) |
| std::string | nix::operator+ (std::string_view s1, const char *s2) |
Variables | |
| constexpr char | nix::treeConn [] = "├───" |
| constexpr char | nix::treeLast [] = "└───" |
| constexpr char | nix::treeLine [] = "│ " |
| constexpr char | nix::treeNull [] = " " |
| std::string nix::base64Encode | ( | std::string_view | s | ) |
Base64 encoding/decoding.
| std::string nix::chomp | ( | std::string_view | s | ) |
Remove trailing whitespace from a string.
| std::string nix::concatMapStringsSep | ( | std::string_view | separator, |
| const C & | iterable, | ||
| F | fn ) |
Apply a function to the iterable's items and concat them with separator.
| std::string nix::concatStringsSep | ( | const std::string_view | sep, |
| const C & | ss ) |
Concatenate the given strings with a separator between the elements.
| std::pair< std::string_view, std::string_view > nix::getLine | ( | std::string_view | s | ) |
Get the prefix of 's' up to and excluding the next line break (LF optionally preceded by CR), and the remainder following the line break.
|
inline |
Provide an addition operator between std::string and std::string_view inexplicably omitted from the standard library.
The reason for this is given in n3512 string_ref: a non-owning reference to a string, revision 2 by Jeffrey Yasskin:
I also omitted operator+(basic_string, basic_string_ref) because LLVM returns a lightweight object from this overload and only performs the concatenation lazily. If we define this overload, we'll have a hard time introducing that lightweight concatenation later.
| Strings nix::quoteStrings | ( | const C & | c | ) |
Add quotes around a collection of strings.
| std::string nix::replaceStrings | ( | std::string | s, |
| std::string_view | from, | ||
| std::string_view | to ) |
Replace all occurrences of a string inside another string.
| std::string nix::shellEscape | ( | const std::string_view | s | ) |
Escape a string as a shell word.
| std::optional< N > nix::string2Float | ( | const std::string_view | s | ) |
Parse a string into a float.
| std::optional< N > nix::string2Int | ( | const std::string_view | s | ) |
Parse a string into an integer.
| N nix::string2IntWithUnitPrefix | ( | std::string_view | s | ) |
Like string2Int(), but support an optional suffix 'K', 'M', 'G' or 'T' denoting a binary unit prefix.
| std::vector< char * > nix::stringsToCharPtrs | ( | const Strings & | ss | ) |
Convert a list of strings to a null-terminated vector of char *s. The result must not be accessed beyond the lifetime of the list of strings.
Modifying the resulting array elements violates the constness of ss.
| std::string nix::stripIndentation | ( | std::string_view | s | ) |
Remove common leading whitespace from the lines in the string 's'. For example, if every line is indented by at least 3 spaces, then we remove 3 spaces from the start of every line.
| C nix::tokenizeString | ( | std::string_view | s, |
| std::string_view | separators = " \t\n\r" ) |
String tokenizer.
| std::string nix::toLower | ( | const std::string & | s | ) |
Convert a string to lower case.
| std::string nix::trim | ( | std::string_view | s, |
| std::string_view | whitespace = " \n\r\t" ) |
Remove whitespace from the start and end of a string.
|
constexpr |
Tree formatting.