1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8)
9
10var xBase64Decode func(string, *uint) uintptr
11
12// Decode a sequence of Base-64 encoded text into binary data. Note
13// that the returned binary data is not necessarily zero-terminated,
14// so it should not be used as a character string.
15func Base64Decode(TextVar string, OutLenVar *uint) uintptr {
16
17 cret := xBase64Decode(TextVar, OutLenVar)
18
19 return cret
20}
21
22var xBase64DecodeInplace func(*[]byte, *uint) byte
23
24// Decode a sequence of Base-64 encoded text into binary data
25// by overwriting the input data.
26func Base64DecodeInplace(TextVar *[]byte, OutLenVar *uint) byte {
27
28 cret := xBase64DecodeInplace(TextVar, OutLenVar)
29
30 return cret
31}
32
33var xBase64DecodeStep func([]byte, uint, *[]byte, *int, *uint) uint
34
35// Incrementally decode a sequence of binary data from its Base-64 stringified
36// representation. By calling this function multiple times you can convert
37// data in chunks to avoid having to have the full encoded data in memory.
38//
39// The output buffer must be large enough to fit all the data that will
40// be written to it. Since base64 encodes 3 bytes in 4 chars you need
41// at least: (@len / 4) * 3 + 3 bytes (+ 3 may be needed in case of non-zero
42// state).
43func Base64DecodeStep(InVar []byte, LenVar uint, OutVar *[]byte, StateVar *int, SaveVar *uint) uint {
44
45 cret := xBase64DecodeStep(InVar, LenVar, OutVar, StateVar, SaveVar)
46
47 return cret
48}
49
50var xBase64Encode func([]byte, uint) string
51
52// Encode a sequence of binary data into its Base-64 stringified
53// representation.
54func Base64Encode(DataVar []byte, LenVar uint) string {
55
56 cret := xBase64Encode(DataVar, LenVar)
57
58 return cret
59}
60
61var xBase64EncodeClose func(bool, *[]byte, *int, *int) uint
62
63// Flush the status from a sequence of calls to g_base64_encode_step().
64//
65// The output buffer must be large enough to fit all the data that will
66// be written to it. It will need up to 4 bytes, or up to 5 bytes if
67// line-breaking is enabled.
68//
69// The @out array will not be automatically nul-terminated.
70func Base64EncodeClose(BreakLinesVar bool, OutVar *[]byte, StateVar *int, SaveVar *int) uint {
71
72 cret := xBase64EncodeClose(BreakLinesVar, OutVar, StateVar, SaveVar)
73
74 return cret
75}
76
77var xBase64EncodeStep func([]byte, uint, bool, *[]byte, *int, *int) uint
78
79// Incrementally encode a sequence of binary data into its Base-64 stringified
80// representation. By calling this function multiple times you can convert
81// data in chunks to avoid having to have the full encoded data in memory.
82//
83// When all of the data has been converted you must call
84// g_base64_encode_close() to flush the saved state.
85//
86// The output buffer must be large enough to fit all the data that will
87// be written to it. Due to the way base64 encodes you will need
88// at least: (@len / 3 + 1) * 4 + 4 bytes (+ 4 may be needed in case of
89// non-zero state). If you enable line-breaking you will need at least:
90// ((@len / 3 + 1) * 4 + 4) / 76 + 1 bytes of extra space.
91//
92// @break_lines is typically used when putting base64-encoded data in emails.
93// It breaks the lines at 76 columns instead of putting all of the text on
94// the same line. This avoids problems with long lines in the email system.
95// Note however that it breaks the lines with `LF` characters, not
96// `CR LF` sequences, so the result cannot be passed directly to SMTP
97// or certain other protocols.
98func Base64EncodeStep(InVar []byte, LenVar uint, BreakLinesVar bool, OutVar *[]byte, StateVar *int, SaveVar *int) uint {
99
100 cret := xBase64EncodeStep(InVar, LenVar, BreakLinesVar, OutVar, StateVar, SaveVar)
101
102 return cret
103}
104
105func init() {
106 core.SetPackageName("GLIB", "glib-2.0")
107 core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
108 var libs []uintptr
109 for _, libPath := range core.GetPaths("GLIB") {
110 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
111 if err != nil {
112 panic(err)
113 }
114 libs = append(libs, lib)
115 }
116
117 core.PuregoSafeRegister(&xBase64Decode, libs, "g_base64_decode")
118 core.PuregoSafeRegister(&xBase64DecodeInplace, libs, "g_base64_decode_inplace")
119 core.PuregoSafeRegister(&xBase64DecodeStep, libs, "g_base64_decode_step")
120 core.PuregoSafeRegister(&xBase64Encode, libs, "g_base64_encode")
121 core.PuregoSafeRegister(&xBase64EncodeClose, libs, "g_base64_encode_close")
122 core.PuregoSafeRegister(&xBase64EncodeStep, libs, "g_base64_encode_step")
123
124}