DETLEF C SDK
Native embedding and package authoring
Loading...
Searching...
No Matches

Functions

DetlefStatus detlef_array_create (DetlefAccess *a, DetlefHandle type_handle, const DetlefHandle *items, size_t count, DetlefHandle *out)
 
DetlefStatus detlef_array_length (DetlefAccess *a, DetlefHandle handle, size_t *out)
 
DetlefStatus detlef_array_get (DetlefAccess *a, DetlefHandle handle, size_t index, DetlefHandle *out)
 
DetlefStatus detlef_array_set (DetlefAccess *a, DetlefHandle handle, size_t index, DetlefHandle new_value)
 
DetlefStatus detlef_array_push (DetlefAccess *a, DetlefHandle handle, DetlefHandle new_value)
 
DetlefStatus detlef_array_remove (DetlefAccess *a, DetlefHandle handle, size_t index, DetlefHandle *out)
 
DetlefStatus detlef_record_create (DetlefAccess *a, DetlefHandle type_handle, const DetlefHandle *items, size_t count, DetlefHandle *out)
 
DetlefStatus detlef_record_get (DetlefAccess *a, DetlefHandle handle, DetlefSlice input, DetlefHandle *out)
 
DetlefStatus detlef_record_set (DetlefAccess *a, DetlefHandle handle, DetlefSlice input, DetlefHandle new_value)
 

Detailed Description

Function Documentation

◆ detlef_array_create()

DetlefStatus detlef_array_create ( DetlefAccess *  a,
DetlefHandle  type_handle,
const DetlefHandle *  items,
size_t  count,
DetlefHandle *  out 
)

Create an array using a resolved array type and borrowed element handles. Input values are copied and their types are checked.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
type_handleBorrowed resolved array type descriptor from detlef_type_array(), not its element type. Not consumed.
itemsBorrowed array of runtime value handles in element order. Values are copied into the array; handles are not consumed.
countNumber of entries in the supplied array.
[out]outOn success, receives an owned array value handle. Release with detlef_handle_release() unless transferred as a callback result.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_array_get()

DetlefStatus detlef_array_get ( DetlefAccess *  a,
DetlefHandle  handle,
size_t  index,
DetlefHandle *  out 
)

Read one array element by zero-based index. The returned handle must be released separately from the array handle.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed array value handle. Not consumed.
indexZero-based element index.
[out]outOn success, receives an owned value handle for the selected array element. Release with detlef_handle_release() unless transferred as a callback result.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_array_length()

DetlefStatus detlef_array_length ( DetlefAccess *  a,
DetlefHandle  handle,
size_t *  out 
)

Read the number of elements in an array object.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed array value handle. Not consumed.
[out]outReceives the number of elements in the array.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_array_push()

DetlefStatus detlef_array_push ( DetlefAccess *  a,
DetlefHandle  handle,
DetlefHandle  new_value 
)

Append a value to an array after checking its element type. The input handle is not consumed.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed array value handle. Not consumed.
new_valueBorrowed value handle to append; its type must match the array's element type. Not consumed.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_array_remove()

DetlefStatus detlef_array_remove ( DetlefAccess *  a,
DetlefHandle  handle,
size_t  index,
DetlefHandle *  out 
)

Remove and return an array element by zero-based index. The array is mutated and the removed value receives a new owned handle.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed array value handle. Not consumed.
indexZero-based element index.
[out]outOn success, receives an owned value handle for the removed array element. Release with detlef_handle_release() unless transferred as a callback result.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_array_set()

DetlefStatus detlef_array_set ( DetlefAccess *  a,
DetlefHandle  handle,
size_t  index,
DetlefHandle  new_value 
)

Replace one array element. The array element type is checked; the supplied value handle is not consumed.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed array value handle. Not consumed.
indexZero-based element index.
new_valueBorrowed replacement value handle; its type must match the array's element type. Not consumed.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_record_create()

DetlefStatus detlef_record_create ( DetlefAccess *  a,
DetlefHandle  type_handle,
const DetlefHandle *  items,
size_t  count,
DetlefHandle *  out 
)

Create a record instance using a resolved record type and field values in declaration order. Inputs are copied and type-checked.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
type_handleBorrowed defined record type descriptor. Not consumed.
itemsBorrowed array of runtime value handles in field declaration order. Values are copied into the record; handles are not consumed.
countNumber of entries in the supplied array.
[out]outOn success, receives an owned record value handle. Release with detlef_handle_release() unless transferred as a callback result.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_record_get()

DetlefStatus detlef_record_get ( DetlefAccess *  a,
DetlefHandle  handle,
DetlefSlice  input,
DetlefHandle *  out 
)

Read a named field from a record instance. The input record handle is not consumed.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed record value handle. Not consumed.
inputBorrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call.
[out]outOn success, receives an owned value handle for the selected record field. Release with detlef_handle_release() unless transferred as a callback result.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.

◆ detlef_record_set()

DetlefStatus detlef_record_set ( DetlefAccess *  a,
DetlefHandle  handle,
DetlefSlice  input,
DetlefHandle  new_value 
)

Replace a named record field after checking its declared type. Neither input handle is consumed.

Parameters
aBorrowed callback access. Must not be freed, saved, or used outside its current callback.
handleBorrowed record value handle. Not consumed.
inputBorrowed UTF-8 name, without a trailing NUL requirement. Storage may be released after the call.
new_valueBorrowed replacement value handle; its type must match the named field's type. Not consumed.
Returns
DETLEF_OK on success; otherwise a DetlefStatus error code.