gtcpwrapperconnection.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/gobject"
12 "github.com/bnema/puregotk/v4/gobject/types"
13)
14
15type TcpWrapperConnectionClass struct {
16 _ structs.HostLayout
17
18 ParentClass TcpConnectionClass
19}
20
21func (x *TcpWrapperConnectionClass) GoPointer() uintptr {
22 return uintptr(unsafe.Pointer(x))
23}
24
25type TcpWrapperConnectionPrivate struct {
26 _ structs.HostLayout
27}
28
29func (x *TcpWrapperConnectionPrivate) GoPointer() uintptr {
30 return uintptr(unsafe.Pointer(x))
31}
32
33// A `GTcpWrapperConnection` can be used to wrap a [class@Gio.IOStream] that is
34// based on a [class@Gio.Socket], but which is not actually a
35// [class@Gio.SocketConnection]. This is used by [class@Gio.SocketClient] so
36// that it can always return a [class@Gio.SocketConnection], even when the
37// connection it has actually created is not directly a
38// [class@Gio.SocketConnection].
39type TcpWrapperConnection struct {
40 TcpConnection
41}
42
43var xTcpWrapperConnectionGLibType func() types.GType
44
45func TcpWrapperConnectionGLibType() types.GType {
46 return xTcpWrapperConnectionGLibType()
47}
48
49func TcpWrapperConnectionNewFromInternalPtr(ptr uintptr) *TcpWrapperConnection {
50 cls := &TcpWrapperConnection{}
51 cls.Ptr = ptr
52 return cls
53}
54
55var xNewTcpWrapperConnection func(uintptr, uintptr) uintptr
56
57// Wraps @base_io_stream and @socket together as a #GSocketConnection.
58func NewTcpWrapperConnection(BaseIoStreamVar *IOStream, SocketVar *Socket) *TcpWrapperConnection {
59 var cls *TcpWrapperConnection
60
61 cret := xNewTcpWrapperConnection(BaseIoStreamVar.GoPointer(), SocketVar.GoPointer())
62
63 if cret == 0 {
64 return nil
65 }
66 cls = &TcpWrapperConnection{}
67 cls.Ptr = cret
68 return cls
69}
70
71var xTcpWrapperConnectionGetBaseIoStream func(uintptr) uintptr
72
73// Gets @conn's base #GIOStream
74func (x *TcpWrapperConnection) GetBaseIoStream() *IOStream {
75 var cls *IOStream
76
77 cret := xTcpWrapperConnectionGetBaseIoStream(x.GoPointer())
78
79 if cret == 0 {
80 return nil
81 }
82 gobject.IncreaseRef(cret)
83 cls = &IOStream{}
84 cls.Ptr = cret
85 return cls
86}
87
88func (c *TcpWrapperConnection) GoPointer() uintptr {
89 if c == nil {
90 return 0
91 }
92 return c.Ptr
93}
94
95func (c *TcpWrapperConnection) SetGoPointer(ptr uintptr) {
96 c.Ptr = ptr
97}
98
99func init() {
100 core.SetPackageName("GIO", "gio-2.0")
101 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
102 var libs []uintptr
103 for _, libPath := range core.GetPaths("GIO") {
104 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
105 if err != nil {
106 panic(err)
107 }
108 libs = append(libs, lib)
109 }
110
111 core.PuregoSafeRegister(&xTcpWrapperConnectionGLibType, libs, "g_tcp_wrapper_connection_get_type")
112
113 core.PuregoSafeRegister(&xNewTcpWrapperConnection, libs, "g_tcp_wrapper_connection_new")
114
115 core.PuregoSafeRegister(&xTcpWrapperConnectionGetBaseIoStream, libs, "g_tcp_wrapper_connection_get_base_io_stream")
116
117}