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"
13 "github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type IOStreamClass struct {
17 _ structs.HostLayout
18
19 ParentClass gobject.ObjectClass
20
21 xGetInputStream uintptr
22
23 xGetOutputStream uintptr
24
25 xCloseFn uintptr
26
27 xCloseAsync uintptr
28
29 xCloseFinish uintptr
30
31 xGReserved1 uintptr
32
33 xGReserved2 uintptr
34
35 xGReserved3 uintptr
36
37 xGReserved4 uintptr
38
39 xGReserved5 uintptr
40
41 xGReserved6 uintptr
42
43 xGReserved7 uintptr
44
45 xGReserved8 uintptr
46
47 xGReserved9 uintptr
48
49 xGReserved10 uintptr
50}
51
52func (x *IOStreamClass) GoPointer() uintptr {
53 return uintptr(unsafe.Pointer(x))
54}
55
56// OverrideGetInputStream sets the "get_input_stream" callback function.
57func (x *IOStreamClass) OverrideGetInputStream(cb func(*IOStream) *InputStream) {
58 if cb == nil {
59 x.xGetInputStream = 0
60 } else {
61 x.xGetInputStream = purego.NewCallback(func(StreamVarp uintptr) uintptr {
62 ret := cb(IOStreamNewFromInternalPtr(StreamVarp))
63 if ret == nil {
64 return 0
65 }
66 return ret.GoPointer()
67 })
68 }
69}
70
71// GetGetInputStream gets the "get_input_stream" callback function.
72func (x *IOStreamClass) GetGetInputStream() func(*IOStream) *InputStream {
73 if x.xGetInputStream == 0 {
74 return nil
75 }
76 var rawCallback func(StreamVarp uintptr) uintptr
77 purego.RegisterFunc(&rawCallback, x.xGetInputStream)
78 return func(StreamVar *IOStream) *InputStream {
79 rawRet := rawCallback(StreamVar.GoPointer())
80 if rawRet == 0 {
81 return nil
82 }
83 ret := &InputStream{}
84 ret.Ptr = rawRet
85 return ret
86 }
87}
88
89// OverrideGetOutputStream sets the "get_output_stream" callback function.
90func (x *IOStreamClass) OverrideGetOutputStream(cb func(*IOStream) *OutputStream) {
91 if cb == nil {
92 x.xGetOutputStream = 0
93 } else {
94 x.xGetOutputStream = purego.NewCallback(func(StreamVarp uintptr) uintptr {
95 ret := cb(IOStreamNewFromInternalPtr(StreamVarp))
96 if ret == nil {
97 return 0
98 }
99 return ret.GoPointer()
100 })
101 }
102}
103
104// GetGetOutputStream gets the "get_output_stream" callback function.
105func (x *IOStreamClass) GetGetOutputStream() func(*IOStream) *OutputStream {
106 if x.xGetOutputStream == 0 {
107 return nil
108 }
109 var rawCallback func(StreamVarp uintptr) uintptr
110 purego.RegisterFunc(&rawCallback, x.xGetOutputStream)
111 return func(StreamVar *IOStream) *OutputStream {
112 rawRet := rawCallback(StreamVar.GoPointer())
113 if rawRet == 0 {
114 return nil
115 }
116 ret := &OutputStream{}
117 ret.Ptr = rawRet
118 return ret
119 }
120}
121
122// OverrideCloseFn sets the "close_fn" callback function.
123func (x *IOStreamClass) OverrideCloseFn(cb func(*IOStream, *Cancellable) bool) {
124 if cb == nil {
125 x.xCloseFn = 0
126 } else {
127 x.xCloseFn = purego.NewCallback(func(StreamVarp uintptr, CancellableVarp uintptr) bool {
128 return cb(IOStreamNewFromInternalPtr(StreamVarp), CancellableNewFromInternalPtr(CancellableVarp))
129 })
130 }
131}
132
133// GetCloseFn gets the "close_fn" callback function.
134func (x *IOStreamClass) GetCloseFn() func(*IOStream, *Cancellable) bool {
135 if x.xCloseFn == 0 {
136 return nil
137 }
138 var rawCallback func(StreamVarp uintptr, CancellableVarp uintptr) bool
139 purego.RegisterFunc(&rawCallback, x.xCloseFn)
140 return func(StreamVar *IOStream, CancellableVar *Cancellable) bool {
141 return rawCallback(StreamVar.GoPointer(), CancellableVar.GoPointer())
142 }
143}
144
145// OverrideCloseAsync sets the "close_async" callback function.
146func (x *IOStreamClass) OverrideCloseAsync(cb func(*IOStream, int, *Cancellable, *AsyncReadyCallback, uintptr)) {
147 if cb == nil {
148 x.xCloseAsync = 0
149 } else {
150 x.xCloseAsync = purego.NewCallback(func(StreamVarp uintptr, IoPriorityVarp int, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr) {
151 cb(IOStreamNewFromInternalPtr(StreamVarp), IoPriorityVarp, CancellableNewFromInternalPtr(CancellableVarp), (*AsyncReadyCallback)(unsafe.Pointer(CallbackVarp)), UserDataVarp)
152 })
153 }
154}
155
156// GetCloseAsync gets the "close_async" callback function.
157func (x *IOStreamClass) GetCloseAsync() func(*IOStream, int, *Cancellable, *AsyncReadyCallback, uintptr) {
158 if x.xCloseAsync == 0 {
159 return nil
160 }
161 var rawCallback func(StreamVarp uintptr, IoPriorityVarp int, CancellableVarp uintptr, CallbackVarp uintptr, UserDataVarp uintptr)
162 purego.RegisterFunc(&rawCallback, x.xCloseAsync)
163 return func(StreamVar *IOStream, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
164 rawCallback(StreamVar.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallbackNullable(CallbackVar), UserDataVar)
165 }
166}
167
168// OverrideCloseFinish sets the "close_finish" callback function.
169func (x *IOStreamClass) OverrideCloseFinish(cb func(*IOStream, AsyncResult) bool) {
170 if cb == nil {
171 x.xCloseFinish = 0
172 } else {
173 x.xCloseFinish = purego.NewCallback(func(StreamVarp uintptr, ResultVarp uintptr) bool {
174 return cb(IOStreamNewFromInternalPtr(StreamVarp), &AsyncResultBase{Ptr: ResultVarp})
175 })
176 }
177}
178
179// GetCloseFinish gets the "close_finish" callback function.
180func (x *IOStreamClass) GetCloseFinish() func(*IOStream, AsyncResult) bool {
181 if x.xCloseFinish == 0 {
182 return nil
183 }
184 var rawCallback func(StreamVarp uintptr, ResultVarp uintptr) bool
185 purego.RegisterFunc(&rawCallback, x.xCloseFinish)
186 return func(StreamVar *IOStream, ResultVar AsyncResult) bool {
187 return rawCallback(StreamVar.GoPointer(), ResultVar.GoPointer())
188 }
189}
190
191// OverrideGReserved1 sets the "_g_reserved1" callback function.
192func (x *IOStreamClass) OverrideGReserved1(cb func()) {
193 if cb == nil {
194 x.xGReserved1 = 0
195 } else {
196 x.xGReserved1 = purego.NewCallback(func() {
197 cb()
198 })
199 }
200}
201
202// GetGReserved1 gets the "_g_reserved1" callback function.
203func (x *IOStreamClass) GetGReserved1() func() {
204 if x.xGReserved1 == 0 {
205 return nil
206 }
207 var rawCallback func()
208 purego.RegisterFunc(&rawCallback, x.xGReserved1)
209 return func() {
210 rawCallback()
211 }
212}
213
214// OverrideGReserved2 sets the "_g_reserved2" callback function.
215func (x *IOStreamClass) OverrideGReserved2(cb func()) {
216 if cb == nil {
217 x.xGReserved2 = 0
218 } else {
219 x.xGReserved2 = purego.NewCallback(func() {
220 cb()
221 })
222 }
223}
224
225// GetGReserved2 gets the "_g_reserved2" callback function.
226func (x *IOStreamClass) GetGReserved2() func() {
227 if x.xGReserved2 == 0 {
228 return nil
229 }
230 var rawCallback func()
231 purego.RegisterFunc(&rawCallback, x.xGReserved2)
232 return func() {
233 rawCallback()
234 }
235}
236
237// OverrideGReserved3 sets the "_g_reserved3" callback function.
238func (x *IOStreamClass) OverrideGReserved3(cb func()) {
239 if cb == nil {
240 x.xGReserved3 = 0
241 } else {
242 x.xGReserved3 = purego.NewCallback(func() {
243 cb()
244 })
245 }
246}
247
248// GetGReserved3 gets the "_g_reserved3" callback function.
249func (x *IOStreamClass) GetGReserved3() func() {
250 if x.xGReserved3 == 0 {
251 return nil
252 }
253 var rawCallback func()
254 purego.RegisterFunc(&rawCallback, x.xGReserved3)
255 return func() {
256 rawCallback()
257 }
258}
259
260// OverrideGReserved4 sets the "_g_reserved4" callback function.
261func (x *IOStreamClass) OverrideGReserved4(cb func()) {
262 if cb == nil {
263 x.xGReserved4 = 0
264 } else {
265 x.xGReserved4 = purego.NewCallback(func() {
266 cb()
267 })
268 }
269}
270
271// GetGReserved4 gets the "_g_reserved4" callback function.
272func (x *IOStreamClass) GetGReserved4() func() {
273 if x.xGReserved4 == 0 {
274 return nil
275 }
276 var rawCallback func()
277 purego.RegisterFunc(&rawCallback, x.xGReserved4)
278 return func() {
279 rawCallback()
280 }
281}
282
283// OverrideGReserved5 sets the "_g_reserved5" callback function.
284func (x *IOStreamClass) OverrideGReserved5(cb func()) {
285 if cb == nil {
286 x.xGReserved5 = 0
287 } else {
288 x.xGReserved5 = purego.NewCallback(func() {
289 cb()
290 })
291 }
292}
293
294// GetGReserved5 gets the "_g_reserved5" callback function.
295func (x *IOStreamClass) GetGReserved5() func() {
296 if x.xGReserved5 == 0 {
297 return nil
298 }
299 var rawCallback func()
300 purego.RegisterFunc(&rawCallback, x.xGReserved5)
301 return func() {
302 rawCallback()
303 }
304}
305
306// OverrideGReserved6 sets the "_g_reserved6" callback function.
307func (x *IOStreamClass) OverrideGReserved6(cb func()) {
308 if cb == nil {
309 x.xGReserved6 = 0
310 } else {
311 x.xGReserved6 = purego.NewCallback(func() {
312 cb()
313 })
314 }
315}
316
317// GetGReserved6 gets the "_g_reserved6" callback function.
318func (x *IOStreamClass) GetGReserved6() func() {
319 if x.xGReserved6 == 0 {
320 return nil
321 }
322 var rawCallback func()
323 purego.RegisterFunc(&rawCallback, x.xGReserved6)
324 return func() {
325 rawCallback()
326 }
327}
328
329// OverrideGReserved7 sets the "_g_reserved7" callback function.
330func (x *IOStreamClass) OverrideGReserved7(cb func()) {
331 if cb == nil {
332 x.xGReserved7 = 0
333 } else {
334 x.xGReserved7 = purego.NewCallback(func() {
335 cb()
336 })
337 }
338}
339
340// GetGReserved7 gets the "_g_reserved7" callback function.
341func (x *IOStreamClass) GetGReserved7() func() {
342 if x.xGReserved7 == 0 {
343 return nil
344 }
345 var rawCallback func()
346 purego.RegisterFunc(&rawCallback, x.xGReserved7)
347 return func() {
348 rawCallback()
349 }
350}
351
352// OverrideGReserved8 sets the "_g_reserved8" callback function.
353func (x *IOStreamClass) OverrideGReserved8(cb func()) {
354 if cb == nil {
355 x.xGReserved8 = 0
356 } else {
357 x.xGReserved8 = purego.NewCallback(func() {
358 cb()
359 })
360 }
361}
362
363// GetGReserved8 gets the "_g_reserved8" callback function.
364func (x *IOStreamClass) GetGReserved8() func() {
365 if x.xGReserved8 == 0 {
366 return nil
367 }
368 var rawCallback func()
369 purego.RegisterFunc(&rawCallback, x.xGReserved8)
370 return func() {
371 rawCallback()
372 }
373}
374
375// OverrideGReserved9 sets the "_g_reserved9" callback function.
376func (x *IOStreamClass) OverrideGReserved9(cb func()) {
377 if cb == nil {
378 x.xGReserved9 = 0
379 } else {
380 x.xGReserved9 = purego.NewCallback(func() {
381 cb()
382 })
383 }
384}
385
386// GetGReserved9 gets the "_g_reserved9" callback function.
387func (x *IOStreamClass) GetGReserved9() func() {
388 if x.xGReserved9 == 0 {
389 return nil
390 }
391 var rawCallback func()
392 purego.RegisterFunc(&rawCallback, x.xGReserved9)
393 return func() {
394 rawCallback()
395 }
396}
397
398// OverrideGReserved10 sets the "_g_reserved10" callback function.
399func (x *IOStreamClass) OverrideGReserved10(cb func()) {
400 if cb == nil {
401 x.xGReserved10 = 0
402 } else {
403 x.xGReserved10 = purego.NewCallback(func() {
404 cb()
405 })
406 }
407}
408
409// GetGReserved10 gets the "_g_reserved10" callback function.
410func (x *IOStreamClass) GetGReserved10() func() {
411 if x.xGReserved10 == 0 {
412 return nil
413 }
414 var rawCallback func()
415 purego.RegisterFunc(&rawCallback, x.xGReserved10)
416 return func() {
417 rawCallback()
418 }
419}
420
421type IOStreamPrivate struct {
422 _ structs.HostLayout
423}
424
425func (x *IOStreamPrivate) GoPointer() uintptr {
426 return uintptr(unsafe.Pointer(x))
427}
428
429// `GIOStream` represents an object that has both read and write streams.
430// Generally the two streams act as separate input and output streams,
431// but they share some common resources and state. For instance, for
432// seekable streams, both streams may use the same position.
433//
434// Examples of `GIOStream` objects are [class@Gio.SocketConnection], which represents
435// a two-way network connection; and [class@Gio.FileIOStream], which represents a
436// file handle opened in read-write mode.
437//
438// To do the actual reading and writing you need to get the substreams
439// with [method@Gio.IOStream.get_input_stream] and
440// [method@Gio.IOStream.get_output_stream].
441//
442// The `GIOStream` object owns the input and the output streams, not the other
443// way around, so keeping the substreams alive will not keep the `GIOStream`
444// object alive. If the `GIOStream` object is freed it will be closed, thus
445// closing the substreams, so even if the substreams stay alive they will
446// always return `G_IO_ERROR_CLOSED` for all operations.
447//
448// To close a stream use [method@Gio.IOStream.close] which will close the common
449// stream object and also the individual substreams. You can also close
450// the substreams themselves. In most cases this only marks the
451// substream as closed, so further I/O on it fails but common state in the
452// `GIOStream` may still be open. However, some streams may support
453// ‘half-closed’ states where one direction of the stream is actually shut down.
454//
455// Operations on `GIOStream`s cannot be started while another operation on the
456// `GIOStream` or its substreams is in progress. Specifically, an application can
457// read from the [class@Gio.InputStream] and write to the
458// [class@Gio.OutputStream] simultaneously (either in separate threads, or as
459// asynchronous operations in the same thread), but an application cannot start
460// any `GIOStream` operation while there is a `GIOStream`, `GInputStream` or
461// `GOutputStream` operation in progress, and an application can’t start any
462// `GInputStream` or `GOutputStream` operation while there is a `GIOStream`
463// operation in progress.
464//
465// This is a product of individual stream operations being associated with a
466// given [type@GLib.MainContext] (the thread-default context at the time the
467// operation was started), rather than entire streams being associated with a
468// single `GMainContext`.
469//
470// GIO may run operations on `GIOStream`s from other (worker) threads, and this
471// may be exposed to application code in the behaviour of wrapper streams, such
472// as [class@Gio.BufferedInputStream] or [class@Gio.TlsConnection]. With such
473// wrapper APIs, application code may only run operations on the base (wrapped)
474// stream when the wrapper stream is idle. Note that the semantics of such
475// operations may not be well-defined due to the state the wrapper stream leaves
476// the base stream in (though they are guaranteed not to crash).
477type IOStream struct {
478 gobject.Object
479}
480
481var xIOStreamGLibType func() types.GType
482
483func IOStreamGLibType() types.GType {
484 return xIOStreamGLibType()
485}
486
487func IOStreamNewFromInternalPtr(ptr uintptr) *IOStream {
488 cls := &IOStream{}
489 cls.Ptr = ptr
490 return cls
491}
492
493var xIOStreamClearPending func(uintptr)
494
495// Clears the pending flag on @stream.
496func (x *IOStream) ClearPending() {
497
498 xIOStreamClearPending(x.GoPointer())
499
500}
501
502var xIOStreamClose func(uintptr, uintptr, **glib.Error) bool
503
504// Closes the stream, releasing resources related to it. This will also
505// close the individual input and output streams, if they are not already
506// closed.
507//
508// Once the stream is closed, all other operations will return
509// %G_IO_ERROR_CLOSED. Closing a stream multiple times will not
510// return an error.
511//
512// Closing a stream will automatically flush any outstanding buffers
513// in the stream.
514//
515// Streams will be automatically closed when the last reference
516// is dropped, but you might want to call this function to make sure
517// resources are released as early as possible.
518//
519// Some streams might keep the backing store of the stream (e.g. a file
520// descriptor) open after the stream is closed. See the documentation for
521// the individual stream for details.
522//
523// On failure the first error that happened will be reported, but the
524// close operation will finish as much as possible. A stream that failed
525// to close will still return %G_IO_ERROR_CLOSED for all operations.
526// Still, it is important to check and report the error to the user,
527// otherwise there might be a loss of data as all data might not be written.
528//
529// If @cancellable is not NULL, then the operation can be cancelled by
530// triggering the cancellable object from another thread. If the operation
531// was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
532// Cancelling a close will still leave the stream closed, but some streams
533// can use a faster close that doesn't block to e.g. check errors.
534//
535// The default implementation of this method just calls close on the
536// individual input/output streams.
537func (x *IOStream) Close(CancellableVar *Cancellable) (bool, error) {
538 var cerr *glib.Error
539
540 cret := xIOStreamClose(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
541 if cerr == nil {
542 return cret, nil
543 }
544 return cret, cerr
545
546}
547
548var xIOStreamCloseAsync func(uintptr, int, uintptr, uintptr, uintptr)
549
550// Requests an asynchronous close of the stream, releasing resources
551// related to it. When the operation is finished @callback will be
552// called. You can then call g_io_stream_close_finish() to get
553// the result of the operation.
554//
555// For behaviour details see g_io_stream_close().
556//
557// The asynchronous methods have a default fallback that uses threads
558// to implement asynchronicity, so they are optional for inheriting
559// classes. However, if you override one you must override all.
560func (x *IOStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
561
562 var CallbackVarRef uintptr
563 if CallbackVar != nil {
564 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
565 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
566 CallbackVarRef = cbRefPtr
567 } else {
568 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
569 cbFn := *CallbackVar
570 cbFn(arg0, arg1, arg2)
571 }
572 CallbackVarRef = purego.NewCallback(fcb)
573 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
574 }
575 }
576
577 xIOStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
578
579}
580
581var xIOStreamCloseFinish func(uintptr, uintptr, **glib.Error) bool
582
583// Closes a stream.
584func (x *IOStream) CloseFinish(ResultVar AsyncResult) (bool, error) {
585 var cerr *glib.Error
586
587 cret := xIOStreamCloseFinish(x.GoPointer(), ResultVar.GoPointer(), &cerr)
588 if cerr == nil {
589 return cret, nil
590 }
591 return cret, cerr
592
593}
594
595var xIOStreamGetInputStream func(uintptr) uintptr
596
597// Gets the input stream for this object. This is used
598// for reading.
599func (x *IOStream) GetInputStream() *InputStream {
600 var cls *InputStream
601
602 cret := xIOStreamGetInputStream(x.GoPointer())
603
604 if cret == 0 {
605 return nil
606 }
607 gobject.IncreaseRef(cret)
608 cls = &InputStream{}
609 cls.Ptr = cret
610 return cls
611}
612
613var xIOStreamGetOutputStream func(uintptr) uintptr
614
615// Gets the output stream for this object. This is used for
616// writing.
617func (x *IOStream) GetOutputStream() *OutputStream {
618 var cls *OutputStream
619
620 cret := xIOStreamGetOutputStream(x.GoPointer())
621
622 if cret == 0 {
623 return nil
624 }
625 gobject.IncreaseRef(cret)
626 cls = &OutputStream{}
627 cls.Ptr = cret
628 return cls
629}
630
631var xIOStreamHasPending func(uintptr) bool
632
633// Checks if a stream has pending actions.
634func (x *IOStream) HasPending() bool {
635
636 cret := xIOStreamHasPending(x.GoPointer())
637 return cret
638}
639
640var xIOStreamIsClosed func(uintptr) bool
641
642// Checks if a stream is closed.
643func (x *IOStream) IsClosed() bool {
644
645 cret := xIOStreamIsClosed(x.GoPointer())
646 return cret
647}
648
649var xIOStreamSetPending func(uintptr) bool
650
651// Sets @stream to have actions pending. If the pending flag is
652// already set or @stream is closed, it will return %FALSE and set
653// @error.
654func (x *IOStream) SetPending() (bool, error) {
655 var cerr *glib.Error
656
657 cret := xIOStreamSetPending(x.GoPointer())
658 if cerr == nil {
659 return cret, nil
660 }
661 return cret, cerr
662
663}
664
665var xIOStreamSpliceAsync func(uintptr, uintptr, IOStreamSpliceFlags, int, uintptr, uintptr, uintptr)
666
667// Asynchronously splice the output stream of @stream1 to the input stream of
668// @stream2, and splice the output stream of @stream2 to the input stream of
669// @stream1.
670//
671// When the operation is finished @callback will be called.
672// You can then call g_io_stream_splice_finish() to get the
673// result of the operation.
674func (x *IOStream) SpliceAsync(Stream2Var *IOStream, FlagsVar IOStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) {
675
676 var CallbackVarRef uintptr
677 if CallbackVar != nil {
678 CallbackVarPtr := uintptr(unsafe.Pointer(CallbackVar))
679 if cbRefPtr, ok := glib.GetCallback(CallbackVarPtr); ok {
680 CallbackVarRef = cbRefPtr
681 } else {
682 fcb := func(arg0 uintptr, arg1 uintptr, arg2 uintptr) {
683 cbFn := *CallbackVar
684 cbFn(arg0, arg1, arg2)
685 }
686 CallbackVarRef = purego.NewCallback(fcb)
687 glib.SaveCallbackWithClosure(CallbackVarPtr, CallbackVarRef, CallbackVar)
688 }
689 }
690
691 xIOStreamSpliceAsync(x.GoPointer(), Stream2Var.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), CallbackVarRef, UserDataVar)
692
693}
694
695func (c *IOStream) GoPointer() uintptr {
696 if c == nil {
697 return 0
698 }
699 return c.Ptr
700}
701
702func (c *IOStream) SetGoPointer(ptr uintptr) {
703 c.Ptr = ptr
704}
705
706// GetPropertyClosed gets the "closed" property.
707// Whether the stream is closed.
708func (x *IOStream) GetPropertyClosed() bool {
709 var v gobject.Value
710 x.GetProperty("closed", &v)
711 return v.GetBoolean()
712}
713
714var xIOStreamSpliceFinish func(uintptr, **glib.Error) bool
715
716// Finishes an asynchronous io stream splice operation.
717func IOStreamSpliceFinish(ResultVar AsyncResult) (bool, error) {
718 var cerr *glib.Error
719
720 cret := xIOStreamSpliceFinish(ResultVar.GoPointer(), &cerr)
721 if cerr == nil {
722 return cret, nil
723 }
724 return cret, cerr
725
726}
727
728func init() {
729 core.SetPackageName("GIO", "gio-2.0")
730 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
731 var libs []uintptr
732 for _, libPath := range core.GetPaths("GIO") {
733 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
734 if err != nil {
735 panic(err)
736 }
737 libs = append(libs, lib)
738 }
739
740 core.PuregoSafeRegister(&xIOStreamGLibType, libs, "g_io_stream_get_type")
741
742 core.PuregoSafeRegister(&xIOStreamClearPending, libs, "g_io_stream_clear_pending")
743 core.PuregoSafeRegister(&xIOStreamClose, libs, "g_io_stream_close")
744 core.PuregoSafeRegister(&xIOStreamCloseAsync, libs, "g_io_stream_close_async")
745 core.PuregoSafeRegister(&xIOStreamCloseFinish, libs, "g_io_stream_close_finish")
746 core.PuregoSafeRegister(&xIOStreamGetInputStream, libs, "g_io_stream_get_input_stream")
747 core.PuregoSafeRegister(&xIOStreamGetOutputStream, libs, "g_io_stream_get_output_stream")
748 core.PuregoSafeRegister(&xIOStreamHasPending, libs, "g_io_stream_has_pending")
749 core.PuregoSafeRegister(&xIOStreamIsClosed, libs, "g_io_stream_is_closed")
750 core.PuregoSafeRegister(&xIOStreamSetPending, libs, "g_io_stream_set_pending")
751 core.PuregoSafeRegister(&xIOStreamSpliceAsync, libs, "g_io_stream_splice_async")
752
753 core.PuregoSafeRegister(&xIOStreamSpliceFinish, libs, "g_io_stream_splice_finish")
754
755}