Type Alias GTypeValueLCopyFunc

Source
pub type GTypeValueLCopyFunc = Option<unsafe extern "C" fn(value: *const GValue, n_collect_values: guint, collect_values: *mut GTypeCValue, collect_flags: guint) -> *mut gchar>;
Expand description

GTypeValueLCopyFunc: @value: the value to lcopy @n_collect_values: the number of collected values @collect_values: (array length=n_collect_values): the collected locations for storage @collect_flags: optional flags

This function is responsible for storing the value contents into arguments passed through a variadic argument list which got collected into collect_values according to lcopy_format.

The n_collect_values argument equals the string length of lcopy_format, and collect_flags may contain %G_VALUE_NOCOPY_CONTENTS.

In contrast to #GTypeValueCollectFunc, this function is obliged to always properly support %G_VALUE_NOCOPY_CONTENTS.

Similar to #GTypeValueCollectFunc the function may prematurely abort by returning a newly allocated string describing an error condition. To complete the string example:

|[ gchar **string_p = collect_values[0].v_pointer; g_return_val_if_fail (string_p != NULL, g_strdup (“string location passed as NULL”));

if (collect_flags & G_VALUE_NOCOPY_CONTENTS) *string_p = value->data[0].v_pointer; else *string_p = g_strdup (value->data[0].v_pointer); ]|

And an illustrative version of this function for reference-counted types:

|[ GObject **object_p = collect_values[0].v_pointer; g_return_val_if_fail (object_p != NULL, g_strdup (“object location passed as NULL”));

if (value->data[0].v_pointer == NULL) *object_p = NULL; else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour *object_p = value->data[0].v_pointer; else *object_p = g_object_ref (value->data[0].v_pointer);

return NULL; ]|

Returns: (transfer full) (nullable): NULL on success, otherwise a newly allocated error string on failure

Since: 2.78

Aliased Type§

enum GTypeValueLCopyFunc {
    None,
    Some(unsafe extern "C" fn(*const _GValue, u32, *mut _GTypeCValue, u32) -> *mut i8),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*const _GValue, u32, *mut _GTypeCValue, u32) -> *mut i8)

Some value of type T.