GLib.StrvBuilder

Fields

None

Methods

add (value)

addv (value)

end ()

unref ()

Details

class GLib.StrvBuilder

GLib.StrvBuilder is a method of easily building dynamically sized None-terminated string arrays.

The following example shows how to build a two element array:

g_autoptr(GStrvBuilder) builder = g_strv_builder_new ();
g_strv_builder_add (builder, "hello");
g_strv_builder_add (builder, "world");
g_auto(GStrv) array = g_strv_builder_end (builder);

New in version 2.68.

add(value)[source]
Parameters:

value (str) – a string.

Add a string to the end of the array.

New in version 2.68.

addv(value)[source]
Parameters:

value ([str]) – the vector of strings to add

Appends all the strings in the given vector to the builder.

New in version 2.70.

end()[source]
Returns:

the constructed string array.

Return type:

[str]

Ends the builder process and returns the constructed None-terminated string array. The returned value should be freed with GLib.strfreev() when no longer needed.

unref()[source]

Decreases the reference count on self.

In the event that there are no more references, releases all memory associated with the GLib.StrvBuilder.

New in version 2.68.