v0.2.1 c0399be

gstrvbuilder.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject/types"
12)
13
14// `GStrvBuilder` is a helper object to build a %NULL-terminated string arrays.
15//
16// The following example shows how to build a two element array:
17//
18// ```c
19//
20//	g_autoptr(GStrvBuilder) builder = g_strv_builder_new ();
21//	g_strv_builder_add (builder, "hello");
22//	g_strv_builder_add (builder, "world");
23//
24//	g_auto(GStrv) array = g_strv_builder_end (builder);
25//
26//	g_assert_true (g_strv_equal (array, (const char *[]) { "hello", "world", NULL }));
27//
28// ```
29type StrvBuilder struct {
30	_ structs.HostLayout
31}
32
33var xStrvBuilderGLibType func() types.GType
34
35func StrvBuilderGLibType() types.GType {
36	return xStrvBuilderGLibType()
37}
38
39func (x *StrvBuilder) GoPointer() uintptr {
40	return uintptr(unsafe.Pointer(x))
41}
42
43var xNewStrvBuilder func() *StrvBuilder
44
45// Creates a new #GStrvBuilder with a reference count of 1.
46// Use g_strv_builder_unref() on the returned value when no longer needed.
47func NewStrvBuilder() *StrvBuilder {
48
49	cret := xNewStrvBuilder()
50	return cret
51}
52
53var xStrvBuilderAdd func(uintptr, string)
54
55// Add a string to the end of the array.
56//
57// Since 2.68
58func (x *StrvBuilder) Add(ValueVar string) {
59
60	xStrvBuilderAdd(x.GoPointer(), ValueVar)
61
62}
63
64var xStrvBuilderAddMany func(uintptr, ...interface{})
65
66// Appends all the given strings to the builder.
67//
68// Since 2.70
69func (x *StrvBuilder) AddMany(varArgs ...interface{}) {
70
71	xStrvBuilderAddMany(x.GoPointer(), varArgs...)
72
73}
74
75var xStrvBuilderAddv func(uintptr, []string)
76
77// Appends all the strings in the given vector to the builder.
78//
79// Since 2.70
80func (x *StrvBuilder) Addv(ValueVar []string) {
81
82	xStrvBuilderAddv(x.GoPointer(), ValueVar)
83
84}
85
86var xStrvBuilderEnd func(uintptr) []string
87
88// Ends the builder process and returns the constructed NULL-terminated string
89// array. The returned value should be freed with g_strfreev() when no longer
90// needed.
91func (x *StrvBuilder) End() []string {
92
93	cret := xStrvBuilderEnd(x.GoPointer())
94	return cret
95}
96
97var xStrvBuilderRef func(uintptr) *StrvBuilder
98
99// Atomically increments the reference count of @builder by one.
100// This function is thread-safe and may be called from any thread.
101func (x *StrvBuilder) Ref() *StrvBuilder {
102
103	cret := xStrvBuilderRef(x.GoPointer())
104	return cret
105}
106
107var xStrvBuilderTake func(uintptr, uintptr)
108
109// Add a string to the end of the array. After @value belongs to the
110// #GStrvBuilder and may no longer be modified by the caller.
111//
112// Since 2.80
113func (x *StrvBuilder) Take(ValueVar string) {
114
115	xStrvBuilderTake(x.GoPointer(), core.GStrdup(ValueVar))
116
117}
118
119var xStrvBuilderUnref func(uintptr)
120
121// Decreases the reference count on @builder.
122//
123// In the event that there are no more references, releases all memory
124// associated with the #GStrvBuilder.
125func (x *StrvBuilder) Unref() {
126
127	xStrvBuilderUnref(x.GoPointer())
128
129}
130
131var xStrvBuilderUnrefToStrv func(uintptr) []string
132
133// Decreases the reference count on the string vector builder, and returns
134// its contents as a `NULL`-terminated string array.
135//
136// This function is especially useful for cases where it's not possible
137// to use `g_autoptr()`.
138//
139// ```c
140// GStrvBuilder *builder = g_strv_builder_new ();
141// g_strv_builder_add (builder, "hello");
142// g_strv_builder_add (builder, "world");
143//
144// GStrv array = g_strv_builder_unref_to_strv (builder);
145//
146// g_assert_true (g_strv_equal (array, (const char *[]) { "hello", "world", NULL }));
147//
148// g_strfreev (array);
149// ```
150func (x *StrvBuilder) UnrefToStrv() []string {
151
152	cret := xStrvBuilderUnrefToStrv(x.GoPointer())
153	return cret
154}
155
156func init() {
157	core.SetPackageName("GLIB", "glib-2.0")
158	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
159	var libs []uintptr
160	for _, libPath := range core.GetPaths("GLIB") {
161		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
162		if err != nil {
163			panic(err)
164		}
165		libs = append(libs, lib)
166	}
167
168	core.PuregoSafeRegister(&xStrvBuilderGLibType, libs, "g_strv_builder_get_type")
169
170	core.PuregoSafeRegister(&xNewStrvBuilder, libs, "g_strv_builder_new")
171
172	core.PuregoSafeRegister(&xStrvBuilderAdd, libs, "g_strv_builder_add")
173	core.PuregoSafeRegister(&xStrvBuilderAddMany, libs, "g_strv_builder_add_many")
174	core.PuregoSafeRegister(&xStrvBuilderAddv, libs, "g_strv_builder_addv")
175	core.PuregoSafeRegister(&xStrvBuilderEnd, libs, "g_strv_builder_end")
176	core.PuregoSafeRegister(&xStrvBuilderRef, libs, "g_strv_builder_ref")
177	core.PuregoSafeRegister(&xStrvBuilderTake, libs, "g_strv_builder_take")
178	core.PuregoSafeRegister(&xStrvBuilderUnref, libs, "g_strv_builder_unref")
179	core.PuregoSafeRegister(&xStrvBuilderUnrefToStrv, libs, "g_strv_builder_unref_to_strv")
180
181}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close