|
Lite³
A JSON-Compatible Zero-Copy Serialization Format
|
Set key-value pair in object. More...
Macros | |
| #define | lite3_ctx_set_null(ctx, ofs, key) |
| Set null in object. | |
| #define | lite3_ctx_set_bool(ctx, ofs, key, value) |
| Set boolean in object. | |
| #define | lite3_ctx_set_i64(ctx, ofs, key, value) |
| Set integer in object. | |
| #define | lite3_ctx_set_f64(ctx, ofs, key, value) |
| Set floating point in object. | |
| #define | lite3_ctx_set_bytes(ctx, ofs, key, bytes, bytes_len) |
| Set bytes in object. | |
| #define | lite3_ctx_set_str(ctx, ofs, key, str) |
| Set string in object. | |
| #define | lite3_ctx_set_str_n(ctx, ofs, key, str, str_len) |
| Set string in object by length. | |
| #define | lite3_ctx_set_obj(ctx, ofs, key, out_ofs) |
| Set object in object. | |
| #define | lite3_ctx_set_arr(ctx, ofs, key, out_ofs) |
| Set array in object. | |
Set key-value pair in object.
An empty buffer must first be initialized using lite3_ctx_init_obj() or lite3_ctx_init_arr() before insertion. See Object / Array Initialization.
The ofs (offset) field is used to target an object or array inside the Lite³ buffer. To target the root-level object/array, use ofs == 0.
| #define lite3_ctx_set_arr | ( | ctx, | |
| ofs, | |||
| key, | |||
| out_ofs | |||
| ) |
Set array in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out_ofs | (size_t *) offset of the newly inserted array (if not needed, pass NULL) |
Definition at line 637 of file lite3_context_api.h.
| #define lite3_ctx_set_bool | ( | ctx, | |
| ofs, | |||
| key, | |||
| value | |||
| ) |
Set boolean in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [in] | value | (bool) boolean value to set |
Definition at line 365 of file lite3_context_api.h.
| #define lite3_ctx_set_bytes | ( | ctx, | |
| ofs, | |||
| key, | |||
| bytes, | |||
| bytes_len | |||
| ) |
Set bytes in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [in] | bytes | (const unsigned char *) bytes pointer |
| [in] | bytes_len | (size_t) bytes amount |
Definition at line 474 of file lite3_context_api.h.
| #define lite3_ctx_set_f64 | ( | ctx, | |
| ofs, | |||
| key, | |||
| value | |||
| ) |
Set floating point in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [in] | value | (double) floating point value to set |
Definition at line 437 of file lite3_context_api.h.
| #define lite3_ctx_set_i64 | ( | ctx, | |
| ofs, | |||
| key, | |||
| value | |||
| ) |
Set integer in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [in] | value | (uint64_t) integer value to set |
Definition at line 401 of file lite3_context_api.h.
| #define lite3_ctx_set_null | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Set null in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
Definition at line 330 of file lite3_context_api.h.
| #define lite3_ctx_set_obj | ( | ctx, | |
| ofs, | |||
| key, | |||
| out_ofs | |||
| ) |
Set object in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out_ofs | (size_t *) offset of the newly inserted object (if not needed, pass NULL) |
Definition at line 596 of file lite3_context_api.h.
| #define lite3_ctx_set_str | ( | ctx, | |
| ofs, | |||
| key, | |||
| str | |||
| ) |
Set string in object.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [in] | str | (const char *) string pointer |
strlen() to learn the size of the string. If you know the length beforehand, it is more efficient to call lite3_ctx_set_str_n(). Definition at line 515 of file lite3_context_api.h.
| #define lite3_ctx_set_str_n | ( | ctx, | |
| ofs, | |||
| key, | |||
| str, | |||
| str_len | |||
| ) |
Set string in object by length.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [in] | str | (const char *) string pointer |
| [in] | str_len | (size_t) string length, exclusive of NULL-terminator. |
str_len is exclusive of the NULL-terminator. Definition at line 557 of file lite3_context_api.h.