#ifndef CPP_JSONNET_H_
#define CPP_JSONNET_H_
#include <cstring>
#include <functional>
#include <map>
#include <string>
extern "C" {
#include "libjsonnet.h"
}
namespace jsonnet {
class Jsonnet {
public:
Jsonnet();
~Jsonnet();
static std::string version();
bool init();
void setMaxStack(uint32_t depth);
void setGcMinObjects(uint32_t objects);
void setGcGrowthTrigger(double growth);
void setStringOutput(bool string_output);
void setMaxTrace(uint32_t lines);
void addImportPath(const std::string& path);
void bindTlaVar(const std::string& key, const std::string& value);
void bindTlaCodeVar(const std::string& key, const std::string& value);
void bindExtVar(const std::string& key, const std::string& value);
void bindExtCodeVar(const std::string& key, const std::string& value);
bool evaluateFile(const std::string& filename, std::string* output);
bool evaluateSnippet(const std::string& filename, const std::string& snippet,
std::string* output);
bool evaluateFileMulti(const std::string& filename,
std::map<std::string, std::string>* outputs);
bool evaluateSnippetMulti(const std::string& filename, const std::string& snippet,
std::map<std::string, std::string>* outputs);
std::string lastError() const;
private:
struct JsonnetVm* vm_;
std::string last_error_;
};
}
#endif