Nix 2.26.3
Nix, the purely functional package manager; unstable internal interfaces
 
Loading...
Searching...
No Matches
print.hh
Go to the documentation of this file.
1#pragma once
9
10#include <iostream>
11
12#include "fmt.hh"
13#include "print-options.hh"
14
15namespace nix {
16
17class EvalState;
18struct Value;
19
28std::ostream & printLiteralString(std::ostream & o, std::string_view s);
29inline std::ostream & printLiteralString(std::ostream & o, const char * s) {
30 return printLiteralString(o, std::string_view(s));
31}
32inline std::ostream & printLiteralString(std::ostream & o, const std::string & s) {
33 return printLiteralString(o, std::string_view(s));
34}
35
37std::ostream & printLiteralBool(std::ostream & o, bool b);
38
44std::ostream & printAttributeName(std::ostream & o, std::string_view s);
45
50bool isReservedKeyword(const std::string_view str);
51
61std::ostream & printIdentifier(std::ostream & o, std::string_view s);
62
63void printValue(EvalState & state, std::ostream & str, Value & v, PrintOptions options = PrintOptions {});
64
69class ValuePrinter {
70 friend std::ostream & operator << (std::ostream & output, const ValuePrinter & printer);
71private:
72 EvalState & state;
73 Value & value;
74 PrintOptions options;
75
76public:
77 ValuePrinter(EvalState & state, Value & value, PrintOptions options = PrintOptions {})
78 : state(state), value(value), options(options) { }
79};
80
81std::ostream & operator<<(std::ostream & output, const ValuePrinter & printer);
82
83
88template<>
89HintFmt & HintFmt::operator%(const ValuePrinter & value);
90
91}
Definition eval.hh:182
HintFmt(const std::string &literal)
Definition fmt.hh:145
Definition print.hh:69
friend std::ostream & operator<<(std::ostream &output, const ValuePrinter &printer)
Definition print.cc:630
return s
Definition lexer.l:459
std::ostream & str
Definition lexer.l:1728
return printLiteralString(o, std::string_view(s))
const T & value
Definition lexer.l:492
Options for printing Nix values.
Definition print-options.hh:39
Definition value.hh:167