39 perror(
"Failed to create lite3_ctx *ctx");
48 perror(
"Failed to build message");
57 perror(
"Failed to set headers");
62 perror(
"Failed to print JSON");
71 perror(
"Failed to get user-agent");
74 printf(
"User agent: %s\n",
LITE3_STR(ctx->buf, user_agent));
#define lite3_ctx_get_str(ctx, ofs, key, out)
Get string value by key.
#define lite3_ctx_get_obj(ctx, ofs, key, out)
Get object 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_obj(ctx, ofs, key, out_ofs)
Set object in object.
#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.