Gwyfile Library
Functions
Item – object

Functions

GwyfileItem * gwyfile_item_new_object (const char *name, GwyfileObject *value)
 Creates a new object GWY file item. More...
 
GwyfileObject * gwyfile_item_get_object (const GwyfileItem *item)
 Gets the object value contained in a GWY file data item. More...
 
GwyfileObject * gwyfile_item_release_object (GwyfileItem *item)
 Releases the object contained in a GWY file data item and frees the item. More...
 
void gwyfile_item_set_object (GwyfileItem *item, GwyfileObject *value)
 Sets the value of an object GWY file item. More...
 

Detailed Description

Function Documentation

◆ gwyfile_item_get_object()

GwyfileObject* gwyfile_item_get_object ( const GwyfileItem *  item)

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

The item must be of the object 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 value of item. The object remains owned by item.

◆ gwyfile_item_new_object()

GwyfileItem* gwyfile_item_new_object ( const char *  name,
GwyfileObject *  value 
)

Creates a new object GWY file item.

The item consumes the provied object and will take care of freeing it later.

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). The object must not be placed in any item yet.
Returns
The newly created GWY file data item.

◆ gwyfile_item_release_object()

GwyfileObject* gwyfile_item_release_object ( GwyfileItem *  item)

Releases the object contained in a GWY file data item and frees the item.

The item must be of the object type. It must be also a root, i.e. not be contained in any object. The object is released from the item, becoming a new root object, and the item is freed.

Parameters
itemA root object GWY file data item.
Returns
The object value of item.
See also
gwyfile_item_free gwyfile_item_get_object gwyfile_object_take

◆ gwyfile_item_set_object()

void gwyfile_item_set_object ( GwyfileItem *  item,
GwyfileObject *  value 
)

Sets the value of an object GWY file item.

The item must be of the object type.

The item consumes the provied object and will take care of freeing it later. It is not permitted to pass an object already present in another item.

Parameters
itemAn object GWY file data item.
valueNew value for the item (to be consumed).