Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
print.hh
Go to the documentation of this file.
1
#pragma once
9
10
#include "
nix/util/fmt.hh
"
11
#include "
nix/expr/value/context.hh
"
12
#include "
nix/expr/print-options.hh
"
13
14
#include <iosfwd>
15
16
namespace
nix {
17
18
class
EvalState
;
19
struct
Value
;
20
29
std::ostream &
printLiteralString
(std::ostream & o, std::string_view s);
30
31
inline
std::ostream &
printLiteralString
(std::ostream & o,
const
char
* s)
32
{
33
return
printLiteralString
(o, std::string_view(s));
34
}
35
36
inline
std::ostream &
printLiteralString
(std::ostream & o,
const
std::string & s)
37
{
38
return
printLiteralString
(o, std::string_view(s));
39
}
40
42
std::ostream &
printLiteralBool
(std::ostream & o,
bool
b);
43
49
std::ostream &
printAttributeName
(std::ostream & o, std::string_view s);
50
55
bool
isReservedKeyword(
const
std::string_view str);
56
66
std::ostream &
printIdentifier
(std::ostream & o, std::string_view s);
67
68
void
printValue(
69
EvalState
& state,
70
std::ostream & str,
71
Value
& v,
72
PrintOptions
options =
PrintOptions
{},
73
NixStringContext
* context =
nullptr
);
74
79
class
ValuePrinter
80
{
81
friend
std::ostream & operator<<(std::ostream & output,
const
ValuePrinter & printer);
82
private
:
83
EvalState
& state;
84
Value
& value;
85
PrintOptions
options;
86
NixStringContext
* context;
87
88
public
:
89
ValuePrinter(
90
EvalState
& state,
Value
& value,
PrintOptions
options =
PrintOptions
{},
NixStringContext
* context =
nullptr
)
91
: state(state)
92
, value(value)
93
, options(options)
94
, context(context)
95
{
96
}
97
};
98
99
std::ostream & operator<<(std::ostream & output,
const
ValuePrinter
& printer);
100
105
template
<>
106
HintFmt
& HintFmt::operator%(
const
ValuePrinter
& value);
107
108
}
// namespace nix
nix::EvalState
Definition
eval.hh:420
nix::HintFmt::HintFmt
HintFmt(const std::string &literal)
Definition
fmt.hh:178
nix::ValuePrinter
Definition
print.hh:80
fmt.hh
context.hh
nix::NixStringContext
std::set< NixStringContextElem > NixStringContext
Definition
context.hh:103
print-options.hh
Options for printing Nix values.
nix::printLiteralString
std::ostream & printLiteralString(std::ostream &o, std::string_view s)
Definition
print.cc:66
nix::printAttributeName
std::ostream & printAttributeName(std::ostream &o, std::string_view s)
Definition
print.cc:130
nix::printIdentifier
std::ostream & printIdentifier(std::ostream &o, std::string_view s)
Definition
print.cc:91
nix::printLiteralBool
std::ostream & printLiteralBool(std::ostream &o, bool b)
Definition
print.cc:71
nix::PrintOptions
Definition
print-options.hh:39
nix::Value
Definition
value.hh:1166
libexpr
include
nix
expr
print.hh
Generated by
1.18.0