build_named_row_static


Description:

[ CCode ( array_length_pos = 1.33333 , array_length_type = "guint" , cname = "dee_model_build_named_row_sunk" ) ]
public unowned Variant[] build_named_row_static (Variant[] out_row_members, string first_column_name, ...)

Version of dee_model_build_named_row for language bindings - as opposed to dee_model_build_named_row, the returned variants will be strong references, therefore you always have to call g_variant_unref on the items and g_free the array itself if null was passed as out_row_members.

If out_row_members is non-%NULL, g_variant_unref will be called on its elements (if also non-%NULL), which allows easy reuse of the array memory in loops.

This is utility function and will not touch or modify this in any way.

Example of memory management for model with schema ("s", "i") and column names ("uri", "count"):

 GVariant		**row_buf;

row_buf = dee_model_build_named_row_sunk (model, NULL, "uri", "file:///",
"count", 0, NULL);
dee_model_append_row (model, row_buf);

for (int i = 1; i < 100; i++)
{
dee_model_append_row (model,
dee_model_build_named_row_sunk (model, row_buf, "uri", "file:///",
"count", i, NULL));
}

g_variant_unref (row_buf[0]);
g_variant_unref (row_buf[1]);
g_free (row_buf);

Parameters:

this

The model to create a row for

out_row_members

An array to write the values to or null to allocate a new array. If non-%NULL it must have a length that is longer or equal to the number of columns in this

first_column_name

A column name

out_array_length

Length of the returned variant array

Returns:

If out_row_members is null a newly allocated array of variants will be returned and the array must be freed with g_free. If out_row_members is non-%NULL it will be reused. Variants in the array will have strong references, which means the caller must make sure that g_variant_unref is called on them.




2022 vala-language.org