// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT package glib import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/gobject/types" ) // `GStrvBuilder` is a helper object to build a %NULL-terminated string arrays. // // The following example shows how to build a two element array: // // ```c // // 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 })); // // ``` type StrvBuilder struct { _ structs.HostLayout } var xStrvBuilderGLibType func() types.GType func StrvBuilderGLibType() types.GType { return xStrvBuilderGLibType() } func (x *StrvBuilder) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xNewStrvBuilder func() *StrvBuilder // Creates a new #GStrvBuilder with a reference count of 1. // Use g_strv_builder_unref() on the returned value when no longer needed. func NewStrvBuilder() *StrvBuilder { cret := xNewStrvBuilder() return cret } var xStrvBuilderAdd func(uintptr, string) // Add a string to the end of the array. // // Since 2.68 func (x *StrvBuilder) Add(ValueVar string) { xStrvBuilderAdd(x.GoPointer(), ValueVar) } var xStrvBuilderAddMany func(uintptr, ...interface{}) // Appends all the given strings to the builder. // // Since 2.70 func (x *StrvBuilder) AddMany(varArgs ...interface{}) { xStrvBuilderAddMany(x.GoPointer(), varArgs...) } var xStrvBuilderAddv func(uintptr, []string) // Appends all the strings in the given vector to the builder. // // Since 2.70 func (x *StrvBuilder) Addv(ValueVar []string) { xStrvBuilderAddv(x.GoPointer(), ValueVar) } var xStrvBuilderEnd func(uintptr) []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. func (x *StrvBuilder) End() []string { cret := xStrvBuilderEnd(x.GoPointer()) return cret } var xStrvBuilderRef func(uintptr) *StrvBuilder // Atomically increments the reference count of @builder by one. // This function is thread-safe and may be called from any thread. func (x *StrvBuilder) Ref() *StrvBuilder { cret := xStrvBuilderRef(x.GoPointer()) return cret } var xStrvBuilderTake func(uintptr, uintptr) // Add a string to the end of the array. After @value belongs to the // #GStrvBuilder and may no longer be modified by the caller. // // Since 2.80 func (x *StrvBuilder) Take(ValueVar string) { xStrvBuilderTake(x.GoPointer(), core.GStrdup(ValueVar)) } var xStrvBuilderUnref func(uintptr) // Decreases the reference count on @builder. // // In the event that there are no more references, releases all memory // associated with the #GStrvBuilder. func (x *StrvBuilder) Unref() { xStrvBuilderUnref(x.GoPointer()) } var xStrvBuilderUnrefToStrv func(uintptr) []string // Decreases the reference count on the string vector builder, and returns // its contents as a `NULL`-terminated string array. // // This function is especially useful for cases where it's not possible // to use `g_autoptr()`. // // ```c // GStrvBuilder *builder = g_strv_builder_new (); // g_strv_builder_add (builder, "hello"); // g_strv_builder_add (builder, "world"); // // GStrv array = g_strv_builder_unref_to_strv (builder); // // g_assert_true (g_strv_equal (array, (const char *[]) { "hello", "world", NULL })); // // g_strfreev (array); // ``` func (x *StrvBuilder) UnrefToStrv() []string { cret := xStrvBuilderUnrefToStrv(x.GoPointer()) return cret } func init() { core.SetPackageName("GLIB", "glib-2.0") core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GLIB") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xStrvBuilderGLibType, libs, "g_strv_builder_get_type") core.PuregoSafeRegister(&xNewStrvBuilder, libs, "g_strv_builder_new") core.PuregoSafeRegister(&xStrvBuilderAdd, libs, "g_strv_builder_add") core.PuregoSafeRegister(&xStrvBuilderAddMany, libs, "g_strv_builder_add_many") core.PuregoSafeRegister(&xStrvBuilderAddv, libs, "g_strv_builder_addv") core.PuregoSafeRegister(&xStrvBuilderEnd, libs, "g_strv_builder_end") core.PuregoSafeRegister(&xStrvBuilderRef, libs, "g_strv_builder_ref") core.PuregoSafeRegister(&xStrvBuilderTake, libs, "g_strv_builder_take") core.PuregoSafeRegister(&xStrvBuilderUnref, libs, "g_strv_builder_unref") core.PuregoSafeRegister(&xStrvBuilderUnrefToStrv, libs, "g_strv_builder_unref_to_strv") }