|
Lite³
A JSON-Compatible Zero-Copy Serialization Format
|
Get value from object by key. More...
Macros | |
| #define | lite3_ctx_get(ctx, ofs, key, out) |
| Get value from object. | |
| #define | lite3_ctx_get_bool(ctx, ofs, key, out) |
| Get boolean value by key. | |
| #define | lite3_ctx_get_i64(ctx, ofs, key, out) |
| Get integer value by key. | |
| #define | lite3_ctx_get_f64(ctx, ofs, key, out) |
| Get floating point value by key. | |
| #define | lite3_ctx_get_bytes(ctx, ofs, key, out) |
| Get bytes value by key. | |
| #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. | |
| #define | lite3_ctx_get_arr(ctx, ofs, key, out) |
| Get array by key. | |
Get value from object by key.
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.
lite3_get_xxx() funtions. Mixing reads and writes however is not thread-safe. | #define lite3_ctx_get | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get value from object.
Unlike other lite3_ctx_get_xxx() functions, this function does not get a specific type. Instead, it produces a generic lite3_val pointer, which points to a value inside the Lite³ buffer. This can be useful in cases where you don't know the exact type of a value beforehand. See lite3_val functions.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (lite3_val *) opaque value pointer |
Definition at line 1563 of file lite3_context_api.h.
| #define lite3_ctx_get_arr | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get array by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (size_t *) array offset |
Definition at line 1799 of file lite3_context_api.h.
| #define lite3_ctx_get_bool | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get boolean value by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (bool *) boolean value |
Definition at line 1584 of file lite3_context_api.h.
| #define lite3_ctx_get_bytes | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get bytes value by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (lite3_bytes *) bytes value |
Definition at line 1686 of file lite3_context_api.h.
| #define lite3_ctx_get_f64 | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get floating point value by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (double *) floating point value |
Definition at line 1652 of file lite3_context_api.h.
| #define lite3_ctx_get_i64 | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get integer value by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (int64_t *) integer value |
Definition at line 1618 of file lite3_context_api.h.
| #define lite3_ctx_get_obj | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get object by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (size_t *) object offset |
Definition at line 1765 of file lite3_context_api.h.
| #define lite3_ctx_get_str | ( | ctx, | |
| ofs, | |||
| key, | |||
| out | |||
| ) |
Get string value by key.
| [in] | ctx | (lite3_ctx *) context pointer |
| [in] | ofs | (size_t) start offset (0 == root) |
| [in] | key | (const char *) key |
| [out] | out | (lite3_str *) string value |
Definition at line 1725 of file lite3_context_api.h.