v0.2.1 c0399be

gzlibdecompressor.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"
13	"github.com/bnema/puregotk/v4/gobject/types"
14)
15
16type ZlibDecompressorClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20}
21
22func (x *ZlibDecompressorClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26// `GZlibDecompressor` is an implementation of [iface@Gio.Converter] that
27// decompresses data compressed with zlib.
28type ZlibDecompressor struct {
29	gobject.Object
30}
31
32var xZlibDecompressorGLibType func() types.GType
33
34func ZlibDecompressorGLibType() types.GType {
35	return xZlibDecompressorGLibType()
36}
37
38func ZlibDecompressorNewFromInternalPtr(ptr uintptr) *ZlibDecompressor {
39	cls := &ZlibDecompressor{}
40	cls.Ptr = ptr
41	return cls
42}
43
44var xNewZlibDecompressor func(ZlibCompressorFormat) uintptr
45
46// Creates a new decompressor.
47func NewZlibDecompressor(FormatVar ZlibCompressorFormat) *ZlibDecompressor {
48	var cls *ZlibDecompressor
49
50	cret := xNewZlibDecompressor(FormatVar)
51
52	if cret == 0 {
53		return nil
54	}
55	cls = &ZlibDecompressor{}
56	cls.Ptr = cret
57	return cls
58}
59
60var xZlibDecompressorGetFileInfo func(uintptr) uintptr
61
62// Gets the [property@Gio.ZlibDecompressor:file-info] property.
63func (x *ZlibDecompressor) GetFileInfo() *FileInfo {
64	var cls *FileInfo
65
66	cret := xZlibDecompressorGetFileInfo(x.GoPointer())
67
68	if cret == 0 {
69		return nil
70	}
71	gobject.IncreaseRef(cret)
72	cls = &FileInfo{}
73	cls.Ptr = cret
74	return cls
75}
76
77func (c *ZlibDecompressor) GoPointer() uintptr {
78	if c == nil {
79		return 0
80	}
81	return c.Ptr
82}
83
84func (c *ZlibDecompressor) SetGoPointer(ptr uintptr) {
85	c.Ptr = ptr
86}
87
88// This is the main operation used when converting data. It is to be called
89// multiple times in a loop, and each time it will do some work, i.e.
90// producing some output (in @outbuf) or consuming some input (from @inbuf) or
91// both. If its not possible to do any work an error is returned.
92//
93// Note that a single call may not consume all input (or any input at all).
94// Also a call may produce output even if given no input, due to state stored
95// in the converter producing output.
96//
97// If any data was either produced or consumed, and then an error happens, then
98// only the successful conversion is reported and the error is returned on the
99// next call.
100//
101// A full conversion loop involves calling this method repeatedly, each time
102// giving it new input and space output space. When there is no more input
103// data after the data in @inbuf, the flag %G_CONVERTER_INPUT_AT_END must be set.
104// The loop will be (unless some error happens) returning %G_CONVERTER_CONVERTED
105// each time until all data is consumed and all output is produced, then
106// %G_CONVERTER_FINISHED is returned instead. Note, that %G_CONVERTER_FINISHED
107// may be returned even if %G_CONVERTER_INPUT_AT_END is not set, for instance
108// in a decompression converter where the end of data is detectable from the
109// data (and there might even be other data after the end of the compressed data).
110//
111// When some data has successfully been converted @bytes_read and is set to
112// the number of bytes read from @inbuf, and @bytes_written is set to indicate
113// how many bytes was written to @outbuf. If there are more data to output
114// or consume (i.e. unless the %G_CONVERTER_INPUT_AT_END is specified) then
115// %G_CONVERTER_CONVERTED is returned, and if no more data is to be output
116// then %G_CONVERTER_FINISHED is returned.
117//
118// On error %G_CONVERTER_ERROR is returned and @error is set accordingly.
119// Some errors need special handling:
120//
121// %G_IO_ERROR_NO_SPACE is returned if there is not enough space
122// to write the resulting converted data, the application should
123// call the function again with a larger @outbuf to continue.
124//
125// %G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough
126// input to fully determine what the conversion should produce,
127// and the %G_CONVERTER_INPUT_AT_END flag is not set. This happens for
128// example with an incomplete multibyte sequence when converting text,
129// or when a regexp matches up to the end of the input (and may match
130// further input). It may also happen when @inbuf_size is zero and
131// there is no more data to produce.
132//
133// When this happens the application should read more input and then
134// call the function again. If further input shows that there is no
135// more data call the function again with the same data but with
136// the %G_CONVERTER_INPUT_AT_END flag set. This may cause the conversion
137// to finish as e.g. in the regexp match case (or, to fail again with
138// %G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion where the
139// input is actually partial).
140//
141// After g_converter_convert() has returned %G_CONVERTER_FINISHED the
142// converter object is in an invalid state where its not allowed
143// to call g_converter_convert() anymore. At this time you can only
144// free the object or call g_converter_reset() to reset it to the
145// initial state.
146//
147// If the flag %G_CONVERTER_FLUSH is set then conversion is modified
148// to try to write out all internal state to the output. The application
149// has to call the function multiple times with the flag set, and when
150// the available input has been consumed and all internal state has
151// been produced then %G_CONVERTER_FLUSHED (or %G_CONVERTER_FINISHED if
152// really at the end) is returned instead of %G_CONVERTER_CONVERTED.
153// This is somewhat similar to what happens at the end of the input stream,
154// but done in the middle of the data.
155//
156// This has different meanings for different conversions. For instance
157// in a compression converter it would mean that we flush all the
158// compression state into output such that if you uncompress the
159// compressed data you get back all the input data. Doing this may
160// make the final file larger due to padding though. Another example
161// is a regexp conversion, where if you at the end of the flushed data
162// have a match, but there is also a potential longer match. In the
163// non-flushed case we would ask for more input, but when flushing we
164// treat this as the end of input and do the match.
165//
166// Flushing is not always possible (like if a charset converter flushes
167// at a partial multibyte sequence). Converters are supposed to try
168// to produce as much output as possible and then return an error
169// (typically %G_IO_ERROR_PARTIAL_INPUT).
170func (x *ZlibDecompressor) Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error) {
171	var cerr *glib.Error
172
173	cret := XGConverterConvert(x.GoPointer(), InbufVar, InbufSizeVar, OutbufVar, OutbufSizeVar, FlagsVar, BytesReadVar, BytesWrittenVar, &cerr)
174	if cerr == nil {
175		return cret, nil
176	}
177	return cret, cerr
178
179}
180
181// Applies @converter to the data in @bytes.
182func (x *ZlibDecompressor) ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error) {
183	var cerr *glib.Error
184
185	cret := XGConverterConvertBytes(x.GoPointer(), BytesVar, &cerr)
186	if cerr == nil {
187		return cret, nil
188	}
189	return cret, cerr
190
191}
192
193// Resets all internal state in the converter, making it behave
194// as if it was just created. If the converter has any internal
195// state that would produce output then that output is lost.
196func (x *ZlibDecompressor) Reset() {
197
198	XGConverterReset(x.GoPointer())
199
200}
201
202func init() {
203	core.SetPackageName("GIO", "gio-2.0")
204	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
205	var libs []uintptr
206	for _, libPath := range core.GetPaths("GIO") {
207		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
208		if err != nil {
209			panic(err)
210		}
211		libs = append(libs, lib)
212	}
213
214	core.PuregoSafeRegister(&xZlibDecompressorGLibType, libs, "g_zlib_decompressor_get_type")
215
216	core.PuregoSafeRegister(&xNewZlibDecompressor, libs, "g_zlib_decompressor_new")
217
218	core.PuregoSafeRegister(&xZlibDecompressorGetFileInfo, libs, "g_zlib_decompressor_get_file_info")
219
220}

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