11#include <nix/nixexpr.hh>
20#define NIX_EXPR(EXPR) EXPR,
48 requires std::is_standard_layout_v<T> && std::is_trivial_v<T>
49std::size_t
encode(std::ostream &OS,
const T &Data) {
50 std::size_t Ret = OS.tellp();
51 OS.write(
reinterpret_cast<const char *
>(&Data),
sizeof(Data));
56std::size_t
encode(std::ostream &OS,
const std::string &Data);
59std::size_t
encode(std::ostream &OS,
const nix::Pos::Origin &Origin);
62void encodeAST(std::ostream &OS,
const nix::SymbolTable &STable,
63 const nix::PosTable &PTable,
const nix::Pos::Origin &Origin,
73 requires std::is_standard_layout_v<T> && std::is_trivial_v<T>
76 std::memcpy(&Obj,
begin(Data),
sizeof(T));
91 nix::PosTable &PTable, nix::SymbolTable &STable);
ArrayRef, BytesRef, and related functions.
Nix expressions declaration.
Pointer pool, for RAII memory management.
Access EvalCache in nix::EvalState.
std::size_t encode(std::ostream &OS, const T &Data)
Basic primitives. Trivial data types are just written to a stream.
const T * begin(ArrayRef< T > B)
Iterator begin. Used for range-based-for
std::size_t decode(BytesRef Data, T &Obj)
Basic primitives. Deocde from bytes by memcpy.
ArrayRef< T > advance(ArrayRef< T > B, long Offset)
Advance the beginning pointer of bytes array.
void encodeAST(std::ostream &OS, const nix::SymbolTable &STable, const nix::PosTable &PTable, const nix::Pos::Origin &Origin, const nix::Expr *E)
Encode an AST. E is the root of the AST.
std::size_t lengthof(ArrayRef< T > B)
Get length of this array.
T consume(BytesRef &Data)
Consume bytes from Data and construct an object of type T.
nix::Expr * consumeAST(BytesRef &Data, PtrPool< nix::Expr > &Pool, nix::PosTable &PTable, nix::SymbolTable &STable)
Weak reference to an array, with begin and end pointers.
A simple pointer pool, a vector of unique_ptrs.