nix-super/src/libexpr-c/nix_api_expr_internal.h

65 lines
995 B
C
Raw Normal View History

2023-07-14 16:53:30 +03:00
#ifndef NIX_API_EXPR_INTERNAL_H
#define NIX_API_EXPR_INTERNAL_H
#include "eval.hh"
#include "attr-set.hh"
2024-02-27 23:08:00 +02:00
#include "nix_api_value.h"
class CListBuilder
{
private:
std::vector<nix::Value *> values;
public:
CListBuilder(size_t capacity)
{
values.reserve(capacity);
}
void push_back(nix::Value * value)
{
values.push_back(value);
}
Value * finish(nix::EvalState * state, nix::Value * list)
{
state->mkList(*list, values.size());
for (size_t n = 0; n < list->listSize(); ++n) {
list->listElems()[n] = values[n];
}
return list;
}
};
2023-07-14 16:53:30 +03:00
2024-01-10 12:58:35 +02:00
struct EvalState
{
nix::EvalState state;
2023-07-14 16:53:30 +03:00
};
struct BindingsBuilder
{
nix::BindingsBuilder builder;
};
2024-02-27 23:08:00 +02:00
struct ListBuilder
{
CListBuilder builder;
};
2024-02-25 01:28:04 +02:00
struct nix_string_return
{
std::string str;
};
struct nix_printer
{
std::ostream & s;
};
struct nix_string_context
{
nix::NixStringContext & ctx;
};
2023-07-14 16:53:30 +03:00
#endif // NIX_API_EXPR_INTERNAL_H