Skip to content

C++ API

Leonard Ramminger edited this page May 14, 2026 · 1 revision

C++ API

Wrapper API

#include "PrebyteEngine.h"

int main() {
    prebyte::Prebyte prebyte;
    prebyte.set_variable("name", "Ada");
    prebyte.add_argument("first-extra");
    std::string output = prebyte.process("Hello {{ name }}\n");
}

Embed API

#include "Engine.h"

prebyte::Engine engine;
prebyte::CompiledTemplate tpl = engine.compile("Hello {{ name }}\n");

prebyte::RenderContext ctx;
ctx.set("name", "Ada");

std::string output = engine.render(tpl, ctx);

Notes

  1. render() wraps render_to()
  2. RenderContext supports scalar and structured Value
  3. compile_file(path) uses path as source and logical path
  4. load_compiled_file(path) loads top-level .pbc

Clone this wiki locally