v0.2.1 c0399be

gpathbuf.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)
12
13// `GPathBuf` is a helper type that allows you to easily build paths from
14// individual elements, using the platform specific conventions for path
15// separators.
16//
17// ```c
18// g_auto (GPathBuf) path;
19//
20// g_path_buf_init (&path);
21//
22// g_path_buf_push (&path, "usr");
23// g_path_buf_push (&path, "bin");
24// g_path_buf_push (&path, "echo");
25//
26// g_autofree char *echo = g_path_buf_to_path (&path);
27// g_assert_cmpstr (echo, ==, "/usr/bin/echo");
28// ```
29//
30// You can also load a full path and then operate on its components:
31//
32// ```c
33// g_auto (GPathBuf) path;
34//
35// g_path_buf_init_from_path (&path, "/usr/bin/echo");
36//
37// g_path_buf_pop (&path);
38// g_path_buf_push (&path, "sh");
39//
40// g_autofree char *sh = g_path_buf_to_path (&path);
41// g_assert_cmpstr (sh, ==, "/usr/bin/sh");
42// ```
43type PathBuf struct {
44	_ structs.HostLayout
45
46	Dummy [8]uintptr
47}
48
49func (x *PathBuf) GoPointer() uintptr {
50	return uintptr(unsafe.Pointer(x))
51}
52
53var xPathBufClear func(uintptr)
54
55// Clears the contents of the path buffer.
56//
57// This function should be use to free the resources in a stack-allocated
58// `GPathBuf` initialized using g_path_buf_init() or
59// g_path_buf_init_from_path().
60func (x *PathBuf) Clear() {
61
62	xPathBufClear(x.GoPointer())
63
64}
65
66var xPathBufClearToPath func(uintptr) string
67
68// Clears the contents of the path buffer and returns the built path.
69//
70// This function returns `NULL` if the `GPathBuf` is empty.
71//
72// See also: g_path_buf_to_path()
73func (x *PathBuf) ClearToPath() string {
74
75	cret := xPathBufClearToPath(x.GoPointer())
76	return cret
77}
78
79var xPathBufCopy func(uintptr) *PathBuf
80
81// Copies the contents of a path buffer into a new `GPathBuf`.
82func (x *PathBuf) Copy() *PathBuf {
83
84	cret := xPathBufCopy(x.GoPointer())
85	return cret
86}
87
88var xPathBufFree func(uintptr)
89
90// Frees a `GPathBuf` allocated by g_path_buf_new().
91func (x *PathBuf) Free() {
92
93	xPathBufFree(x.GoPointer())
94
95}
96
97var xPathBufFreeToPath func(uintptr) string
98
99// Frees a `GPathBuf` allocated by g_path_buf_new(), and
100// returns the path inside the buffer.
101//
102// This function returns `NULL` if the `GPathBuf` is empty.
103//
104// See also: g_path_buf_to_path()
105func (x *PathBuf) FreeToPath() string {
106
107	cret := xPathBufFreeToPath(x.GoPointer())
108	return cret
109}
110
111var xPathBufInit func(uintptr) *PathBuf
112
113// Initializes a `GPathBuf` instance.
114func (x *PathBuf) Init() *PathBuf {
115
116	cret := xPathBufInit(x.GoPointer())
117	return cret
118}
119
120var xPathBufInitFromPath func(uintptr, uintptr) *PathBuf
121
122// Initializes a `GPathBuf` instance with the given path.
123func (x *PathBuf) InitFromPath(PathVar *string) *PathBuf {
124
125	PathVarPtr := core.GStrdupNullable(PathVar)
126	defer core.GFreeNullable(PathVarPtr)
127
128	cret := xPathBufInitFromPath(x.GoPointer(), PathVarPtr)
129	return cret
130}
131
132var xPathBufPop func(uintptr) bool
133
134// Removes the last element of the path buffer.
135//
136// If there is only one element in the path buffer (for example, `/` on
137// Unix-like operating systems or the drive on Windows systems), it will
138// not be removed and %FALSE will be returned instead.
139//
140// |[<!-- language="C" -->
141// GPathBuf buf, cmp;
142//
143// g_path_buf_init_from_path (&buf, "/bin/sh");
144//
145// g_path_buf_pop (&buf);
146// g_path_buf_init_from_path (&cmp, "/bin");
147// g_assert_true (g_path_buf_equal (&buf, &cmp));
148// g_path_buf_clear (&cmp);
149//
150// g_path_buf_pop (&buf);
151// g_path_buf_init_from_path (&cmp, "/");
152// g_assert_true (g_path_buf_equal (&buf, &cmp));
153// g_path_buf_clear (&cmp);
154//
155// g_path_buf_clear (&buf);
156// ]|
157func (x *PathBuf) Pop() bool {
158
159	cret := xPathBufPop(x.GoPointer())
160	return cret
161}
162
163var xPathBufPush func(uintptr, string) *PathBuf
164
165// Extends the given path buffer with @path.
166//
167// If @path is absolute, it replaces the current path.
168//
169// If @path contains a directory separator, the buffer is extended by
170// as many elements the path provides.
171//
172// On Windows, both forward slashes and backslashes are treated as
173// directory separators. On other platforms, %G_DIR_SEPARATOR_S is the
174// only directory separator.
175//
176// |[<!-- language="C" -->
177// GPathBuf buf, cmp;
178//
179// g_path_buf_init_from_path (&buf, "/tmp");
180// g_path_buf_push (&buf, ".X11-unix/X0");
181// g_path_buf_init_from_path (&cmp, "/tmp/.X11-unix/X0");
182// g_assert_true (g_path_buf_equal (&buf, &cmp));
183// g_path_buf_clear (&cmp);
184//
185// g_path_buf_push (&buf, "/etc/locale.conf");
186// g_path_buf_init_from_path (&cmp, "/etc/locale.conf");
187// g_assert_true (g_path_buf_equal (&buf, &cmp));
188// g_path_buf_clear (&cmp);
189//
190// g_path_buf_clear (&buf);
191// ]|
192func (x *PathBuf) Push(PathVar string) *PathBuf {
193
194	cret := xPathBufPush(x.GoPointer(), PathVar)
195	return cret
196}
197
198var xPathBufSetExtension func(uintptr, uintptr) bool
199
200// Adds an extension to the file name in the path buffer.
201//
202// If @extension is `NULL`, the extension will be unset.
203//
204// If the path buffer does not have a file name set, this function returns
205// `FALSE` and leaves the path buffer unmodified.
206func (x *PathBuf) SetExtension(ExtensionVar *string) bool {
207
208	ExtensionVarPtr := core.GStrdupNullable(ExtensionVar)
209	defer core.GFreeNullable(ExtensionVarPtr)
210
211	cret := xPathBufSetExtension(x.GoPointer(), ExtensionVarPtr)
212	return cret
213}
214
215var xPathBufSetFilename func(uintptr, string) bool
216
217// Sets the file name of the path.
218//
219// If the path buffer is empty, the filename is left unset and this
220// function returns `FALSE`.
221//
222// If the path buffer only contains the root element (on Unix-like operating
223// systems) or the drive (on Windows), this is the equivalent of pushing
224// the new @file_name.
225//
226// If the path buffer contains a path, this is the equivalent of
227// popping the path buffer and pushing @file_name, creating a
228// sibling of the original path.
229//
230// |[<!-- language="C" -->
231// GPathBuf buf, cmp;
232//
233// g_path_buf_init_from_path (&buf, "/");
234//
235// g_path_buf_set_filename (&buf, "bar");
236// g_path_buf_init_from_path (&cmp, "/bar");
237// g_assert_true (g_path_buf_equal (&buf, &cmp));
238// g_path_buf_clear (&cmp);
239//
240// g_path_buf_set_filename (&buf, "baz.txt");
241// g_path_buf_init_from_path (&cmp, "/baz.txt");
242// g_assert_true (g_path_buf_equal (&buf, &cmp);
243// g_path_buf_clear (&cmp);
244//
245// g_path_buf_clear (&buf);
246// ]|
247func (x *PathBuf) SetFilename(FileNameVar string) bool {
248
249	cret := xPathBufSetFilename(x.GoPointer(), FileNameVar)
250	return cret
251}
252
253var xPathBufToPath func(uintptr) string
254
255// Retrieves the built path from the path buffer.
256//
257// On Windows, the result contains backslashes as directory separators,
258// even if forward slashes were used in input.
259//
260// If the path buffer is empty, this function returns `NULL`.
261func (x *PathBuf) ToPath() string {
262
263	cret := xPathBufToPath(x.GoPointer())
264	return cret
265}
266
267var xPathBufEqual func(uintptr, uintptr) bool
268
269// Compares two path buffers for equality and returns `TRUE`
270// if they are equal.
271//
272// The paths inside the path buffers are not going to be normalized,
273// so `X/Y/Z/A/..`, `X/./Y/Z` and `X/Y/Z` are not going to be considered
274// equal.
275//
276// This function can be passed to g_hash_table_new() as the
277// `key_equal_func` parameter.
278func PathBufEqual(V1Var uintptr, V2Var uintptr) bool {
279
280	cret := xPathBufEqual(V1Var, V2Var)
281
282	return cret
283}
284
285func init() {
286	core.SetPackageName("GLIB", "glib-2.0")
287	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
288	var libs []uintptr
289	for _, libPath := range core.GetPaths("GLIB") {
290		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
291		if err != nil {
292			panic(err)
293		}
294		libs = append(libs, lib)
295	}
296
297	core.PuregoSafeRegister(&xPathBufEqual, libs, "g_path_buf_equal")
298
299	core.PuregoSafeRegister(&xPathBufClear, libs, "g_path_buf_clear")
300	core.PuregoSafeRegister(&xPathBufClearToPath, libs, "g_path_buf_clear_to_path")
301	core.PuregoSafeRegister(&xPathBufCopy, libs, "g_path_buf_copy")
302	core.PuregoSafeRegister(&xPathBufFree, libs, "g_path_buf_free")
303	core.PuregoSafeRegister(&xPathBufFreeToPath, libs, "g_path_buf_free_to_path")
304	core.PuregoSafeRegister(&xPathBufInit, libs, "g_path_buf_init")
305	core.PuregoSafeRegister(&xPathBufInitFromPath, libs, "g_path_buf_init_from_path")
306	core.PuregoSafeRegister(&xPathBufPop, libs, "g_path_buf_pop")
307	core.PuregoSafeRegister(&xPathBufPush, libs, "g_path_buf_push")
308	core.PuregoSafeRegister(&xPathBufSetExtension, libs, "g_path_buf_set_extension")
309	core.PuregoSafeRegister(&xPathBufSetFilename, libs, "g_path_buf_set_filename")
310	core.PuregoSafeRegister(&xPathBufToPath, libs, "g_path_buf_to_path")
311
312}

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