Lite³
A JSON-Compatible Zero-Copy Serialization Format
Loading...
Searching...
No Matches
Array Get

Get value from array by index. More...

Functions

static int lite3_ctx_arr_get_bool (lite3_ctx *ctx, size_t ofs, uint32_t index, bool *out)
 Get boolean value by index.
 
static int lite3_ctx_arr_get_i64 (lite3_ctx *ctx, size_t ofs, uint32_t index, int64_t *out)
 Get integer value by index.
 
static int lite3_ctx_arr_get_f64 (lite3_ctx *ctx, size_t ofs, uint32_t index, double *out)
 Get floating point value by index.
 
static int lite3_ctx_arr_get_bytes (lite3_ctx *ctx, size_t ofs, uint32_t index, lite3_bytes *out)
 Get bytes value by index.
 
static int lite3_ctx_arr_get_str (lite3_ctx *ctx, size_t ofs, uint32_t index, lite3_str *out)
 Get string value by index.
 
static int lite3_ctx_arr_get_obj (lite3_ctx *ctx, size_t ofs, uint32_t index, size_t *__restrict out_ofs)
 Get object by index.
 
static int lite3_ctx_arr_get_arr (lite3_ctx *ctx, size_t ofs, uint32_t index, size_t *__restrict out_ofs)
 Get array by index.
 

Detailed Description

Get value from array by index.

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.

Returns
  • Returns 0 on success
  • Returns < 0 on error
Warning
Read-only operations are thread-safe. This includes all lite3_arr_get_xxx() funtions. Mixing reads and writes however is not thread-safe.

Function Documentation

◆ lite3_ctx_arr_get_arr()

static int lite3_ctx_arr_get_arr ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
size_t *__restrict  out_ofs 
)
inlinestatic

Get array by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]out_ofsarray offset

Definition at line 2008 of file lite3_context_api.h.

◆ lite3_ctx_arr_get_bool()

static int lite3_ctx_arr_get_bool ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
bool *  out 
)
inlinestatic

Get boolean value by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]outboolean value

Definition at line 1847 of file lite3_context_api.h.

◆ lite3_ctx_arr_get_bytes()

static int lite3_ctx_arr_get_bytes ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
lite3_bytes out 
)
inlinestatic

Get bytes value by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]outbytes value

Definition at line 1922 of file lite3_context_api.h.

◆ lite3_ctx_arr_get_f64()

static int lite3_ctx_arr_get_f64 ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
double *  out 
)
inlinestatic

Get floating point value by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]outfloating point value

Definition at line 1897 of file lite3_context_api.h.

◆ lite3_ctx_arr_get_i64()

static int lite3_ctx_arr_get_i64 ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
int64_t *  out 
)
inlinestatic

Get integer value by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]outinteger value

Definition at line 1872 of file lite3_context_api.h.

◆ lite3_ctx_arr_get_obj()

static int lite3_ctx_arr_get_obj ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
size_t *__restrict  out_ofs 
)
inlinestatic

Get object by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]out_ofsobject offset

Definition at line 1983 of file lite3_context_api.h.

◆ lite3_ctx_arr_get_str()

static int lite3_ctx_arr_get_str ( lite3_ctx ctx,
size_t  ofs,
uint32_t  index,
lite3_str out 
)
inlinestatic

Get string value by index.

Returns
0 on success
< 0 on error
Parameters
[in]ctxcontext pointer
[in]ofsstart offset (0 == root)
[in]indexarray index
[out]outstring value

Definition at line 1952 of file lite3_context_api.h.