39 perror(
"Failed to create lite3_ctx *ctx");
48 perror(
"Failed to build message");
55 perror(
"Failed to get email");
61 perror(
"Failed to set email");
70 printf(
"Marie's email: %s\n\n",
LITE3_STR(ctx->buf, email));
72 const char *country =
"Germany";
73 size_t country_len = strlen(country);
76 perror(
"Failed to set country");
81 perror(
"Failed to print JSON");
#define lite3_ctx_get_str(ctx, ofs, key, out)
Get string value by key.
static int lite3_ctx_init_obj(lite3_ctx *ctx)
Initialize a Lite³ context as an object.
static int lite3_ctx_json_print(lite3_ctx *ctx, size_t ofs)
Print Lite³ buffer as JSON to stdout
static lite3_ctx * lite3_ctx_create(void)
Create context with minimum size.
void lite3_ctx_destroy(lite3_ctx *ctx)
Destroy context.
#define lite3_ctx_set_str_n(ctx, ofs, key, str, str_len)
Set string in object by length.
#define lite3_ctx_set_i64(ctx, ofs, key, value)
Set integer in object.
#define lite3_ctx_set_str(ctx, ofs, key, str)
Set string in object.
#define LITE3_STR(buf, val)
Generational pointer / safe access wrapper.
Lite³ Context API Header.
Struct holding a reference to a string inside a Lite³ buffer.