|
Lite³
A JSON-Compatible Zero-Copy Serialization Format
|
Utility functions. More...
Macros | |
| #define | lite3_ctx_get_type(ctx, ofs, key) |
| Find value by key and return value type. | |
| #define | lite3_ctx_get_type_size(ctx, ofs, key, out) |
| Find value by key and write back type size. | |
| #define | lite3_ctx_exists(ctx, ofs, key) |
| Attempt to find a key. | |
| #define | lite3_ctx_is_null(ctx, ofs, key) |
| Find value by key and test for null type. | |
| #define | lite3_ctx_is_bool(ctx, ofs, key) |
| Find value by key and test for bool type. | |
| #define | lite3_ctx_is_i64(ctx, ofs, key) |
| Find value by key and test for integer type. | |
| #define | lite3_ctx_is_f64(ctx, ofs, key) |
| Find value by key and test for floating point type. | |
| #define | lite3_ctx_is_bytes(ctx, ofs, key) |
| Find value by key and test for bytes type. | |
| #define | lite3_ctx_is_str(ctx, ofs, key) |
| Find value by key and test for string type. | |
| #define | lite3_ctx_is_obj(ctx, ofs, key) |
| Find value by key and test for object type. | |
| #define | lite3_ctx_is_arr(ctx, ofs, key) |
| Find value by key and test for array type. | |
Functions | |
| static void | lite3_ctx_print (lite3_ctx *ctx) |
| View the internal structure of a Lite³ buffer. | |
| static int | lite3_ctx_count (lite3_ctx *ctx, size_t ofs, uint32_t *out) |
| Write back the number of object entries or array elements. | |
Utility functions.
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_exists | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Attempt to find a key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true on success false on failure Definition at line 1279 of file lite3_context_api.h.
| #define lite3_ctx_get_type | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and return value type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
LITE3_TYPE_INVALID on error (key cannot be found) Definition at line 1215 of file lite3_context_api.h.
| #define lite3_ctx_get_type_size | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Find value by key and write back type size.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (size *) type size |
LITE3_TYPE_BYTES or LITE3_TYPE_STRING, the number of bytes (including NULL-terminator for string) are written back. Definition at line 1246 of file lite3_context_api.h.
| #define lite3_ctx_is_arr | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for array type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1513 of file lite3_context_api.h.
| #define lite3_ctx_is_bool | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for bool type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1357 of file lite3_context_api.h.
| #define lite3_ctx_is_bytes | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for bytes type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1435 of file lite3_context_api.h.
| #define lite3_ctx_is_f64 | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for floating point type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1409 of file lite3_context_api.h.
| #define lite3_ctx_is_i64 | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for integer type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1383 of file lite3_context_api.h.
| #define lite3_ctx_is_null | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for null type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1331 of file lite3_context_api.h.
| #define lite3_ctx_is_obj | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for object type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1487 of file lite3_context_api.h.
| #define lite3_ctx_is_str | ( | ctx, | |
| ofs, | |||
| key | |||
| ) |
Find value by key and test for string type.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
true if the value matches the type false if the type does not match or the key cannot be found Definition at line 1461 of file lite3_context_api.h.
|
inlinestatic |
Write back the number of object entries or array elements.
This function can be called on objects and arrays.
| [in] | ctx | context pointer |
| [in] | ofs | start offset (0 == root) |
| [out] | out | number of object entries or array elements |
Definition at line 1303 of file lite3_context_api.h.
|
inlinestatic |
View the internal structure of a Lite³ buffer.
Requires LITE3_DEBUG enabled. See Library Configuration Options.
Definition at line 1200 of file lite3_context_api.h.