Gwyfile Library
Functions
Item – object array

Functions

GwyfileItem * gwyfile_item_new_object_array (const char *name, GwyfileObject **value, uint32_t array_length)
 Creates a new object array GWY file item. More...
 
GwyfileObject *const * gwyfile_item_get_object_array (const GwyfileItem *item)
 Gets the object array value contained in a GWY file data item. More...
 
void gwyfile_item_set_object_array (GwyfileItem *item, GwyfileObject **value, uint32_t array_length)
 Sets the value of a object array GWY file item. More...
 

Detailed Description

Function Documentation

◆ gwyfile_item_get_object_array()

GwyfileObject* const* gwyfile_item_get_object_array ( const GwyfileItem *  item)

Gets the object array value contained in a GWY file data item.

Use gwyfile_item_array_length() to obtain the array length.

The item must be of the object array type. Use gwyfile_item_type() to check item type if the type may not match the expected type. Use gwyfile_object_get_with_type() to obtain object items ensuring the type.

Parameters
itemAn object GWY file data item.
Returns
The object array value of item. The array and objects ownership does not change.

◆ gwyfile_item_new_object_array()

GwyfileItem* gwyfile_item_new_object_array ( const char *  name,
GwyfileObject **  value,
uint32_t  array_length 
)

Creates a new object array GWY file item.

The item consumes the provided array and all objects inside and takes care of freeing them later. You must not touch the array any more; it can be already freed when this function returns.

Parameters
nameItem name. It must be a non-empty UTF-8-encoded string (usually, it should be an ASCII string). A copy of the string will be made.
valueItem value (to be consumed).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.
Returns
The newly created GWY file data item.

◆ gwyfile_item_set_object_array()

void gwyfile_item_set_object_array ( GwyfileItem *  item,
GwyfileObject **  value,
uint32_t  array_length 
)

Sets the value of a object array GWY file item.

The item must be of the object array type.

The item consumes the provided array and the objects inside and takes care of freeing them later. You must not touch the array any more; it can be already freed when this function returns.

Parameters
itemA object array GWY file data item.
valueNew value for the item (to be consumed).
array_lengthArray length. It must be non-zero as GWY files do not permit empty arrays.