v0.2.2 9100209

gfileinputstream.go RawHistoryFolder

1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
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/glib"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type FileInputStreamClass struct {
16	_ structs.HostLayout
17
18	ParentClass InputStreamClass
19
20	xTell uintptr
21
22	xCanSeek uintptr
23
24	xSeek uintptr
25
26	xQueryInfo uintptr
27
28	xQueryInfoAsync uintptr
29
30	xQueryInfoFinish uintptr
31
32	xGReserved1 uintptr
33
34	xGReserved2 uintptr
35
36	xGReserved3 uintptr
37
38	xGReserved4 uintptr
39
40	xGReserved5 uintptr
41}
42
43func (x *FileInputStreamClass) GoPointer() uintptr {
44	return uintptr(unsafe.Pointer(x))
45}
46
47// OverrideTell sets the "tell" callback function.
48func (x *FileInputStreamClass) OverrideTell(cb func(*FileInputStream) int64) {
49	if cb == nil {
50		x.xTell = 0
51	} else {
52		x.xTell = purego.NewCallback(func(StreamVarp uintptr) int64 {
53			return cb(FileInputStreamNewFromInternalPtr(StreamVarp))
54		})
55	}
56}
57
58// GetTell gets the "tell" callback function.
59func (x *FileInputStreamClass) GetTell() func(*FileInputStream) int64 {
60	if x.xTell == 0 {
61		return nil
62	}
63	var rawCallback func(StreamVarp uintptr) int64
64	purego.RegisterFunc(&rawCallback, x.xTell)
65	return func(StreamVar *FileInputStream) int64 {
66		return rawCallback(StreamVar.GoPointer())
67	}
68}
69
70// OverrideCanSeek sets the "can_seek" callback function.
71func (x *FileInputStreamClass) OverrideCanSeek(cb func(*FileInputStream) bool) {
72	if cb == nil {
73		x.xCanSeek = 0
74	} else {
75		x.xCanSeek = purego.NewCallback(func(StreamVarp uintptr) bool {
76			return cb(FileInputStreamNewFromInternalPtr(StreamVarp))
77		})
78	}
79}
80
81// GetCanSeek gets the "can_seek" callback function.
82func (x *FileInputStreamClass) GetCanSeek() func(*FileInputStream) bool {
83	if x.xCanSeek == 0 {
84		return nil
85	}
86	var rawCallback func(StreamVarp uintptr) bool
87	purego.RegisterFunc(&rawCallback, x.xCanSeek)
88	return func(StreamVar *FileInputStream) bool {
89		return rawCallback(StreamVar.GoPointer())
90	}
91}
92
93// OverrideSeek sets the "seek" callback function.
94func (x *FileInputStreamClass) OverrideSeek(cb func(*FileInputStream, int64, glib.SeekType, *Cancellable) bool) {
95	if cb == nil {
96		x.xSeek = 0
97	} else {
98		x.xSeek = purego.NewCallback(func(StreamVarp uintptr, OffsetVarp int64, TypeVarp glib.SeekType, CancellableVarp uintptr) bool {
99			return cb(FileInputStreamNewFromInternalPtr(StreamVarp), OffsetVarp, TypeVarp, CancellableNewFromInternalPtr(CancellableVarp))
100		})
101	}
102}
103
104// GetSeek gets the "seek" callback function.
105func (x *FileInputStreamClass) GetSeek() func(*FileInputStream, int64, glib.SeekType, *Cancellable) bool {
106	if x.xSeek == 0 {
107		return nil
108	}
109	var rawCallback func(StreamVarp uintptr, OffsetVarp int64, TypeVarp glib.SeekType, CancellableVarp uintptr) bool
110	purego.RegisterFunc(&rawCallback, x.xSeek)
111	return func(StreamVar *FileInputStream, OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) bool {
112		return rawCallback(StreamVar.GoPointer(), OffsetVar, TypeVar, CancellableVar.GoPointer())
113	}
114}
115
116// OverrideQueryInfo sets the "query_info" callback function.
117func (x *FileInputStreamClass) OverrideQueryInfo(cb func(*FileInputStream, string, *Cancellable) *FileInfo) {
118	if cb == nil {
119		x.xQueryInfo = 0
120	} else {
121		x.xQueryInfo = purego.NewCallback(func(StreamVarp uintptr, AttributesVarp string, CancellableVarp uintptr) uintptr {
122			ret := cb(FileInputStreamNewFromInternalPtr(StreamVarp), AttributesVarp, CancellableNewFromInternalPtr(CancellableVarp))
123			if ret == nil {
124				return 0
125			}
126			return ret.GoPointer()
127		})
128	}
129}
130
131// GetQueryInfo gets the "query_info" callback function.
132func (x *FileInputStreamClass) GetQueryInfo() func(*FileInputStream, string, *Cancellable) *FileInfo {
133	if x.xQueryInfo == 0 {
134		return nil
135	}
136	var rawCallback func(StreamVarp uintptr, AttributesVarp string, CancellableVarp uintptr) uintptr
137	purego.RegisterFunc(&rawCallback, x.xQueryInfo)
138	return func(StreamVar *FileInputStream, AttributesVar string, CancellableVar *Cancellable) *FileInfo {
139		rawRet := rawCallback(StreamVar.GoPointer(), AttributesVar, CancellableVar.GoPointer())
140		if rawRet == 0 {
141			return nil
142		}
143		ret := &FileInfo{}
144		ret.Ptr = rawRet
145		return ret
146	}
147}
148
149// OverrideQueryInfoAsync sets the "query_info_async" callback function.
150func (x *FileInputStreamClass) OverrideQueryInfoAsync(cb func(*FileInputStream, string, int, *Cancellable, *AsyncReadyCallback, uintptr)) {
151	if cb == nil {
152		x.xQueryInfoAsync = 0
153	} else {
154		x.xQueryInfoAsync = purego.NewCallback(func(StreamVarp uintptr, AttributesVarp string, IoPriorityVarp int, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
155			cb(FileInputStreamNewFromInternalPtr(StreamVarp), AttributesVarp, IoPriorityVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
156		})
157	}
158}
159
160// GetQueryInfoAsync gets the "query_info_async" callback function.
161func (x *FileInputStreamClass) GetQueryInfoAsync() func(*FileInputStream, string, int, *Cancellable, *AsyncReadyCallback, uintptr) {
162	if x.xQueryInfoAsync == 0 {
163		return nil
164	}
165	var rawCallback func(StreamVarp uintptr, AttributesVarp string, IoPriorityVarp int, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
166	purego.RegisterFunc(&rawCallback, x.xQueryInfoAsync)
167	return func(StreamVar *FileInputStream, AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
168		rawCallback(StreamVar.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
169	}
170}
171
172// OverrideQueryInfoFinish sets the "query_info_finish" callback function.
173func (x *FileInputStreamClass) OverrideQueryInfoFinish(cb func(*FileInputStream, AsyncResult) *FileInfo) {
174	if cb == nil {
175		x.xQueryInfoFinish = 0
176	} else {
177		x.xQueryInfoFinish = purego.NewCallback(func(StreamVarp uintptr, ResultVarp uintptr) uintptr {
178			ret := cb(FileInputStreamNewFromInternalPtr(StreamVarp), &AsyncResultBase{Ptr: ResultVarp})
179			if ret == nil {
180				return 0
181			}
182			return ret.GoPointer()
183		})
184	}
185}
186
187// GetQueryInfoFinish gets the "query_info_finish" callback function.
188func (x *FileInputStreamClass) GetQueryInfoFinish() func(*FileInputStream, AsyncResult) *FileInfo {
189	if x.xQueryInfoFinish == 0 {
190		return nil
191	}
192	var rawCallback func(StreamVarp uintptr, ResultVarp uintptr) uintptr
193	purego.RegisterFunc(&rawCallback, x.xQueryInfoFinish)
194	return func(StreamVar *FileInputStream, ResultVar AsyncResult) *FileInfo {
195		rawRet := rawCallback(StreamVar.GoPointer(), ResultVar.GoPointer())
196		if rawRet == 0 {
197			return nil
198		}
199		ret := &FileInfo{}
200		ret.Ptr = rawRet
201		return ret
202	}
203}
204
205// OverrideGReserved1 sets the "_g_reserved1" callback function.
206func (x *FileInputStreamClass) OverrideGReserved1(cb func()) {
207	if cb == nil {
208		x.xGReserved1 = 0
209	} else {
210		x.xGReserved1 = purego.NewCallback(func() {
211			cb()
212		})
213	}
214}
215
216// GetGReserved1 gets the "_g_reserved1" callback function.
217func (x *FileInputStreamClass) GetGReserved1() func() {
218	if x.xGReserved1 == 0 {
219		return nil
220	}
221	var rawCallback func()
222	purego.RegisterFunc(&rawCallback, x.xGReserved1)
223	return func() {
224		rawCallback()
225	}
226}
227
228// OverrideGReserved2 sets the "_g_reserved2" callback function.
229func (x *FileInputStreamClass) OverrideGReserved2(cb func()) {
230	if cb == nil {
231		x.xGReserved2 = 0
232	} else {
233		x.xGReserved2 = purego.NewCallback(func() {
234			cb()
235		})
236	}
237}
238
239// GetGReserved2 gets the "_g_reserved2" callback function.
240func (x *FileInputStreamClass) GetGReserved2() func() {
241	if x.xGReserved2 == 0 {
242		return nil
243	}
244	var rawCallback func()
245	purego.RegisterFunc(&rawCallback, x.xGReserved2)
246	return func() {
247		rawCallback()
248	}
249}
250
251// OverrideGReserved3 sets the "_g_reserved3" callback function.
252func (x *FileInputStreamClass) OverrideGReserved3(cb func()) {
253	if cb == nil {
254		x.xGReserved3 = 0
255	} else {
256		x.xGReserved3 = purego.NewCallback(func() {
257			cb()
258		})
259	}
260}
261
262// GetGReserved3 gets the "_g_reserved3" callback function.
263func (x *FileInputStreamClass) GetGReserved3() func() {
264	if x.xGReserved3 == 0 {
265		return nil
266	}
267	var rawCallback func()
268	purego.RegisterFunc(&rawCallback, x.xGReserved3)
269	return func() {
270		rawCallback()
271	}
272}
273
274// OverrideGReserved4 sets the "_g_reserved4" callback function.
275func (x *FileInputStreamClass) OverrideGReserved4(cb func()) {
276	if cb == nil {
277		x.xGReserved4 = 0
278	} else {
279		x.xGReserved4 = purego.NewCallback(func() {
280			cb()
281		})
282	}
283}
284
285// GetGReserved4 gets the "_g_reserved4" callback function.
286func (x *FileInputStreamClass) GetGReserved4() func() {
287	if x.xGReserved4 == 0 {
288		return nil
289	}
290	var rawCallback func()
291	purego.RegisterFunc(&rawCallback, x.xGReserved4)
292	return func() {
293		rawCallback()
294	}
295}
296
297// OverrideGReserved5 sets the "_g_reserved5" callback function.
298func (x *FileInputStreamClass) OverrideGReserved5(cb func()) {
299	if cb == nil {
300		x.xGReserved5 = 0
301	} else {
302		x.xGReserved5 = purego.NewCallback(func() {
303			cb()
304		})
305	}
306}
307
308// GetGReserved5 gets the "_g_reserved5" callback function.
309func (x *FileInputStreamClass) GetGReserved5() func() {
310	if x.xGReserved5 == 0 {
311		return nil
312	}
313	var rawCallback func()
314	purego.RegisterFunc(&rawCallback, x.xGReserved5)
315	return func() {
316		rawCallback()
317	}
318}
319
320type FileInputStreamPrivate struct {
321	_ structs.HostLayout
322}
323
324func (x *FileInputStreamPrivate) GoPointer() uintptr {
325	return uintptr(unsafe.Pointer(x))
326}
327
328// `GFileInputStream` provides input streams that take their
329// content from a file.
330//
331// `GFileInputStream` implements [iface@Gio.Seekable], which allows the input
332// stream to jump to arbitrary positions in the file, provided the
333// filesystem of the file allows it. To find the position of a file
334// input stream, use [method@Gio.Seekable.tell]. To find out if a file input
335// stream supports seeking, use [vfunc@Gio.Seekable.can_seek].
336// To position a file input stream, use [vfunc@Gio.Seekable.seek].
337type FileInputStream struct {
338	InputStream
339}
340
341var xFileInputStreamGLibType func() types.GType
342
343func FileInputStreamGLibType() types.GType {
344	return xFileInputStreamGLibType()
345}
346
347func FileInputStreamNewFromInternalPtr(ptr uintptr) *FileInputStream {
348	cls := &FileInputStream{}
349	cls.Ptr = ptr
350	return cls
351}
352
353var xFileInputStreamQueryInfo func(uintptr, string, uintptr, **glib.Error) uintptr
354
355// Queries a file input stream the given @attributes. This function blocks
356// while querying the stream. For the asynchronous (non-blocking) version
357// of this function, see g_file_input_stream_query_info_async(). While the
358// stream is blocked, the stream will set the pending flag internally, and
359// any other operations on the stream will fail with %G_IO_ERROR_PENDING.
360func (x *FileInputStream) QueryInfo(AttributesVar string, CancellableVar *Cancellable) (*FileInfo, error) {
361	var cls *FileInfo
362	var cerr *glib.Error
363
364	cret := xFileInputStreamQueryInfo(x.GoPointer(), AttributesVar, CancellableVar.GoPointer(), &cerr)
365
366	if cret == 0 {
367		return nil, cerr
368	}
369	cls = &FileInfo{}
370	cls.Ptr = cret
371	if cerr == nil {
372		return cls, nil
373	}
374	return cls, cerr
375
376}
377
378var xFileInputStreamQueryInfoAsync func(uintptr, string, int, uintptr, uintptr, uintptr)
379
380// Queries the stream information asynchronously.
381// When the operation is finished @callback will be called.
382// You can then call g_file_input_stream_query_info_finish()
383// to get the result of the operation.
384//
385// For the synchronous version of this function,
386// see g_file_input_stream_query_info().
387//
388// If @cancellable is not %NULL, then the operation can be cancelled by
389// triggering the cancellable object from another thread. If the operation
390// was cancelled, the error %G_IO_ERROR_CANCELLED will be set
391func (x *FileInputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
392
393	var CallbackVarRef uintptr
394	if CallbackVar != nil {
395		CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
396		if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
397			CallbackVarRef = cbRefPtr
398		} else {
399			fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
400				cbFn := *CallbackVar
401				cbFn(arg0, arg1, arg2)
402			}
403			CallbackVarRef = purego.NewCallback(fcb)
404			glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
405		}
406	}
407
408	xFileInputStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
409
410}
411
412var xFileInputStreamQueryInfoFinish func(uintptr, uintptr, **glib.Error) uintptr
413
414// Finishes an asynchronous info query operation.
415func (x *FileInputStream) QueryInfoFinish(ResultVar AsyncResult) (*FileInfo, error) {
416	var cls *FileInfo
417	var cerr *glib.Error
418
419	cret := xFileInputStreamQueryInfoFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
420
421	if cret == 0 {
422		return nil, cerr
423	}
424	cls = &FileInfo{}
425	cls.Ptr = cret
426	if cerr == nil {
427		return cls, nil
428	}
429	return cls, cerr
430
431}
432
433func (c *FileInputStream) GoPointer() uintptr {
434	if c == nil {
435		return 0
436	}
437	return c.Ptr
438}
439
440func (c *FileInputStream) SetGoPointer(ptr uintptr) {
441	c.Ptr = ptr
442}
443
444// Tests if the stream supports the #GSeekableIface.
445func (x *FileInputStream) CanSeek() bool {
446
447	cret := XGSeekableCanSeek(x.GoPointer())
448	return cret
449}
450
451// Tests if the length of the stream can be adjusted with
452// g_seekable_truncate().
453func (x *FileInputStream) CanTruncate() bool {
454
455	cret := XGSeekableCanTruncate(x.GoPointer())
456	return cret
457}
458
459// Seeks in the stream by the given @offset, modified by @type.
460//
461// Attempting to seek past the end of the stream will have different
462// results depending on if the stream is fixed-sized or resizable.  If
463// the stream is resizable then seeking past the end and then writing
464// will result in zeros filling the empty space.  Seeking past the end
465// of a resizable stream and reading will result in EOF.  Seeking past
466// the end of a fixed-sized stream will fail.
467//
468// Any operation that would result in a negative offset will fail.
469//
470// If @cancellable is not %NULL, then the operation can be cancelled by
471// triggering the cancellable object from another thread. If the operation
472// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
473func (x *FileInputStream) Seek(OffsetVar int64, TypeVar glib.SeekType, CancellableVar *Cancellable) (bool, error) {
474	var cerr *glib.Error
475
476	cret := XGSeekableSeek(x.GoPointer(), OffsetVar, TypeVar, CancellableVar.GoPointer(), &cerr)
477	if cerr == nil {
478		return cret, nil
479	}
480	return cret, cerr
481
482}
483
484// Tells the current position within the stream.
485func (x *FileInputStream) Tell() int64 {
486
487	cret := XGSeekableTell(x.GoPointer())
488	return cret
489}
490
491// Sets the length of the stream to @offset. If the stream was previously
492// larger than @offset, the extra data is discarded. If the stream was
493// previously shorter than @offset, it is extended with NUL ('\0') bytes.
494//
495// If @cancellable is not %NULL, then the operation can be cancelled by
496// triggering the cancellable object from another thread. If the operation
497// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. If an
498// operation was partially finished when the operation was cancelled the
499// partial result will be returned, without an error.
500func (x *FileInputStream) Truncate(OffsetVar int64, CancellableVar *Cancellable) (bool, error) {
501	var cerr *glib.Error
502
503	cret := XGSeekableTruncate(x.GoPointer(), OffsetVar, CancellableVar.GoPointer(), &cerr)
504	if cerr == nil {
505		return cret, nil
506	}
507	return cret, cerr
508
509}
510
511func init() {
512	core.SetPackageName("GIO", "gio-2.0")
513	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
514	var libs []uintptr
515	for _, libPath := range core.GetPaths("GIO") {
516		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
517		if err != nil {
518			panic(err)
519		}
520		libs = append(libs, lib)
521	}
522
523	core.PuregoSafeRegister(&xFileInputStreamGLibType, libs, "g_file_input_stream_get_type")
524
525	core.PuregoSafeRegister(&xFileInputStreamQueryInfo, libs, "g_file_input_stream_query_info")
526	core.PuregoSafeRegister(&xFileInputStreamQueryInfoAsync, libs, "g_file_input_stream_query_info_async")
527	core.PuregoSafeRegister(&xFileInputStreamQueryInfoFinish, libs, "g_file_input_stream_query_info_finish")
528
529}

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