Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
escape-string.hh File Reference
#include <limits>
#include <ostream>

Go to the source code of this file.

Classes

struct  nix::EscapeStringOptions

Functions

std::ostream & nix::escapeString (std::ostream &output, std::string_view string, EscapeStringOptions options)
std::ostream & nix::escapeString (std::ostream &output, const char *s)
std::ostream & nix::escapeString (std::ostream &output, const std::string &s)
std::string nix::escapeString (std::string_view s, EscapeStringOptions options)
std::string nix::escapeString (const char *s, EscapeStringOptions options={})

Function Documentation

◆ escapeString() [1/2]

std::ostream & nix::escapeString ( std::ostream & output,
std::string_view s,
EscapeStringOptions options = {} )

Escape a string for output.

With default optional parameters, the output string will round-trip through the Nix evaluator (i.e. you can copy/paste this function's output into the REPL and have it evaluate as the string that got passed in).

With non-default optional parameters, the output string will be human-readable.

See EscapeStringOptions for more details on customizing the output.

◆ escapeString() [2/2]

std::string nix::escapeString ( std::string_view s,
EscapeStringOptions options = {} )

Escape a string for output, writing the escaped result to a new string.