StrvBuilder

class StrvBuilder(pointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance

GStrvBuilder is a helper object to build a null-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);

g_assert_true (g_strv_equal (array, (const char *[]) { "hello", "world", NULL }));

Skipped during bindings generation

  • method add_many: Varargs parameter is not supported

Since

2.68

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val glibStrvBuilderPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>?

Functions

Link copied to clipboard
fun add(value: String)

Add a string to the end of the array.

Link copied to clipboard
fun addv(value: List<String>)

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

Link copied to clipboard
fun end(): List<String>

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

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Atomically increments the reference count of @builder by one. This function is thread-safe and may be called from any thread.

Link copied to clipboard
fun take(value: String)

Add a string to the end of the array. After @value belongs to the #GStrvBuilder and may no longer be modified by the caller.

Link copied to clipboard
fun unref()

Decreases the reference count on @builder.

Link copied to clipboard

Decreases the reference count on the string vector builder, and returns its contents as a NULL-terminated string array.