Struct

GLibStrvBuilder

Description [src]

struct GStrvBuilder {
  /* No available fields */
}

GStrvBuilder is a method of easily building dynamically sized 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);
Available since:2.68

Functions

g_strv_builder_new

Creates a new GStrvBuilder with a reference count of 1. Use g_strv_builder_unref() on the returned value when no longer needed.

Available since: 2.68

Instance methods

g_strv_builder_add

Add a string to the end of the array.

g_strv_builder_add_many

Appends all the given strings to the builder.

g_strv_builder_addv

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

g_strv_builder_end

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.

g_strv_builder_ref

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

Available since: 2.68

g_strv_builder_unref

Decreases the reference count on builder.

Available since: 2.68