Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
Access and Conversion

Borrowed views, unambiguous lookups and exact integer conversions. More...

Functions

JSONBOURNE_API jsonbourne_str * jsonbourne_get_str (jsonbourne_val *val)
 Borrow a string payload without allocating or copying.
JSONBOURNE_API jsonbourne_num * jsonbourne_get_num (jsonbourne_val *val)
 Borrow the original number-token view.
JSONBOURNE_API jsonbourne_obj * jsonbourne_get_obj (jsonbourne_val *val)
 Borrow the ordered object payload.
JSONBOURNE_API jsonbourne_arr * jsonbourne_get_arr (jsonbourne_val *val)
 Borrow the ordered array payload.
JSONBOURNE_API int jsonbourne_is_true (const jsonbourne_val *val)
 Test the true tag without coercing numbers or strings.
JSONBOURNE_API int jsonbourne_is_false (const jsonbourne_val *val)
 Test the false tag without truthiness conversion.
JSONBOURNE_API int jsonbourne_is_null (const jsonbourne_val *val)
 Distinguish JSON null from a missing C pointer.
JSONBOURNE_API const jsonbourne_val * jsonbourne_obj_getn (const jsonbourne_val *val, const char *key, size_t len)
 Find the first exact decoded member name, including embedded NUL bytes.
JSONBOURNE_API const jsonbourne_val * jsonbourne_obj_getn_unique (const jsonbourne_val *val, const char *key, size_t len)
 Require exactly one decoded matching key instead of silently choosing.
JSONBOURNE_API const jsonbourne_val * jsonbourne_arr_get (const jsonbourne_val *val, size_t idx)
 Locate a zero-based array element by bounded linked traversal.
JSONBOURNE_API int jsonbourne_num_to_uint (const jsonbourne_num *num, uint64_t *out)
 Convert an unsigned decimal integer token exactly, without coercion.
JSONBOURNE_API int jsonbourne_num_to_sint (const jsonbourne_num *num, int64_t *out)
 Convert a signed decimal integer token exactly, including INT64_MIN.
JSONBOURNE_API const jsonbourne_val * jsonbourne_ptr_getn (const jsonbourne_val *val, const char *pointer, size_t len)
 Resolve an RFC 6901 pointer without allocating decoded path tokens.
JSONBOURNE_API const char * jsonbourne_read_err_desc (jsonbourne_read_code code)
 Borrow human-readable diagnostic text without allocating.

Detailed Description

Borrowed views, unambiguous lookups and exact integer conversions.

Function Documentation

◆ jsonbourne_arr_get()

JSONBOURNE_API const jsonbourne_val * jsonbourne_arr_get ( const jsonbourne_val * val,
size_t idx )

Locate a zero-based array element by bounded linked traversal.

Parameters
[in]valAccessible array value.
[in]idxZero-based element index.
Returns
Borrowed element, or NULL for invalid input/index/traversal.
Note
Lookup is linear in idx and does not validate the unvisited suffix.

Definition at line 1991 of file jsonbourne.c.

◆ jsonbourne_get_arr()

JSONBOURNE_API jsonbourne_arr * jsonbourne_get_arr ( jsonbourne_val * val)

Borrow the ordered array payload.

Parameters
[in]valValue to inspect; NULL is accepted.
Returns
Array view, or NULL for a different tag/NULL value.

Definition at line 1924 of file jsonbourne.c.

◆ jsonbourne_get_num()

JSONBOURNE_API jsonbourne_num * jsonbourne_get_num ( jsonbourne_val * val)

Borrow the original number-token view.

Parameters
[in]valValue to inspect; NULL is accepted.
Returns
Number view, or NULL for a different tag/NULL value.
Note
No floating-point conversion or ownership transfer occurs.

Definition at line 1916 of file jsonbourne.c.

◆ jsonbourne_get_obj()

JSONBOURNE_API jsonbourne_obj * jsonbourne_get_obj ( jsonbourne_val * val)

Borrow the ordered object payload.

Parameters
[in]valValue to inspect; NULL is accepted.
Returns
Object view, or NULL for a different tag/NULL value.

Definition at line 1920 of file jsonbourne.c.

◆ jsonbourne_get_str()

JSONBOURNE_API jsonbourne_str * jsonbourne_get_str ( jsonbourne_val * val)

Borrow a string payload without allocating or copying.

Parameters
[in]valValue to inspect; NULL is accepted.
Returns
String view, or NULL for a different tag/NULL value.
Note
The view shares the source root/arena's lifetime.

Definition at line 1912 of file jsonbourne.c.

◆ jsonbourne_is_false()

JSONBOURNE_API int jsonbourne_is_false ( const jsonbourne_val * val)

Test the false tag without truthiness conversion.

Parameters
[in]valValue to inspect; NULL is accepted.
Returns
1 only for a non-NULL false-tagged value, otherwise 0.

Definition at line 1932 of file jsonbourne.c.

◆ jsonbourne_is_null()

JSONBOURNE_API int jsonbourne_is_null ( const jsonbourne_val * val)

Distinguish JSON null from a missing C pointer.

Parameters
[in]valValue to inspect; NULL itself is not a JSON null node.
Returns
1 only for a non-NULL null-tagged value, otherwise 0.

Definition at line 1936 of file jsonbourne.c.

◆ jsonbourne_is_true()

JSONBOURNE_API int jsonbourne_is_true ( const jsonbourne_val * val)

Test the true tag without coercing numbers or strings.

Parameters
[in]valValue to inspect; NULL is accepted.
Returns
1 only for a non-NULL true-tagged value, otherwise 0.

Definition at line 1928 of file jsonbourne.c.

◆ jsonbourne_num_to_sint()

JSONBOURNE_API int jsonbourne_num_to_sint ( const jsonbourne_num * num,
int64_t * out )

Convert a signed decimal integer token exactly, including INT64_MIN.

Parameters
[in]numDecimal integer spelling with an optional minus, but no plus.
[out]outRequired destination, written only on success.
Return values
1The integer fits int64_t and was stored.
0Invalid token/arguments or overflow; out remains unchanged.
Note
The negative range has one extra magnitude; conversion avoids negating INT64_MIN or overflowing an intermediate signed value.

Definition at line 2031 of file jsonbourne.c.

◆ jsonbourne_num_to_uint()

JSONBOURNE_API int jsonbourne_num_to_uint ( const jsonbourne_num * num,
uint64_t * out )

Convert an unsigned decimal integer token exactly, without coercion.

Parameters
[in]numToken view; signs, fractions, exponents and leading zeroes are rejected.
[out]outRequired destination, written only on success.
Return values
1The integer fits uint64_t and was stored.
0Invalid token/arguments or overflow; out remains unchanged.
Note
Checking before each multiply/add avoids floating-point rounding and unsigned wraparound at UINT64_MAX.

Convert an integer token exactly; exponent/fraction/coercion are rejected.

Definition at line 2013 of file jsonbourne.c.

◆ jsonbourne_obj_getn()

JSONBOURNE_API const jsonbourne_val * jsonbourne_obj_getn ( const jsonbourne_val * val,
const char * key,
size_t len )

Find the first exact decoded member name, including embedded NUL bytes.

Parameters
[in]valAccessible object value.
[in]keyDecoded key bytes; NULL is accepted only when len is zero.
[in]lenExact key byte count, not a terminator-inclusive size.
Returns
Borrowed first-match value, or NULL for no match/invalid traversal.
Note
Returns immediately on a match; it does not validate the remaining list or reject duplicates. Use jsonbourne_obj_getn_unique() for configuration keys.

Definition at line 1982 of file jsonbourne.c.

◆ jsonbourne_obj_getn_unique()

JSONBOURNE_API const jsonbourne_val * jsonbourne_obj_getn_unique ( const jsonbourne_val * val,
const char * key,
size_t len )

Require exactly one decoded matching key instead of silently choosing.

Parameters
[in]valAccessible object value.
[in]keyDecoded key bytes; NULL is accepted only when len is zero.
[in]lenExact key byte count.
Returns
Borrowed value, or NULL for duplicates, no match or malformed traversal.
Note
Comparing decoded bytes catches aliases such as "a" and "\u0061".

Definition at line 1986 of file jsonbourne.c.

◆ jsonbourne_ptr_getn()

JSONBOURNE_API const jsonbourne_val * jsonbourne_ptr_getn ( const jsonbourne_val * val,
const char * pointer,
size_t len )

Resolve an RFC 6901 pointer without allocating decoded path tokens.

Parameters
[in]valAccessible root to query.
[in]pointerPointer bytes, not URI-fragment notation; NULL only for len zero.
[in]lenExact pointer byte count; zero selects the root itself.
Returns
Borrowed result, or NULL for invalid syntax, ambiguity or a missing path.
Note
Object names must match uniquely after ~0/~1 decoding. Array indices are checked decimal integers without leading zeroes; '-' is not an element.

RFC 6901 lookup. Object tokens must identify exactly one decoded member.

Definition at line 2075 of file jsonbourne.c.

◆ jsonbourne_read_err_desc()

JSONBOURNE_API const char * jsonbourne_read_err_desc ( jsonbourne_read_code code)

Borrow human-readable diagnostic text without allocating.

Parameters
[in]codeRead code; unrecognized codes select the generic diagnostic.
Returns
Static NUL-terminated text that must not be modified or freed.
Note
Branch on numeric codes, not these intentionally editable messages.

Definition at line 2138 of file jsonbourne.c.