v0.2.1 c0399be

gcharsetconverter.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 CharsetConverterClass struct {
17	_ structs.HostLayout
18
19	ParentClass gobject.ObjectClass
20}
21
22func (x *CharsetConverterClass) GoPointer() uintptr {
23	return uintptr(unsafe.Pointer(x))
24}
25
26// `GCharsetConverter` is an implementation of [iface@Gio.Converter] based on
27// [struct@GLib.IConv].
28type CharsetConverter struct {
29	gobject.Object
30}
31
32var xCharsetConverterGLibType func() types.GType
33
34func CharsetConverterGLibType() types.GType {
35	return xCharsetConverterGLibType()
36}
37
38func CharsetConverterNewFromInternalPtr(ptr uintptr) *CharsetConverter {
39	cls := &CharsetConverter{}
40	cls.Ptr = ptr
41	return cls
42}
43
44var xNewCharsetConverter func(string, string, **glib.Error) uintptr
45
46// Creates a new #GCharsetConverter.
47func NewCharsetConverter(ToCharsetVar string, FromCharsetVar string) (*CharsetConverter, error) {
48	var cls *CharsetConverter
49	var cerr *glib.Error
50
51	cret := xNewCharsetConverter(ToCharsetVar, FromCharsetVar, &cerr)
52
53	if cret == 0 {
54		return nil, cerr
55	}
56	cls = &CharsetConverter{}
57	cls.Ptr = cret
58	if cerr == nil {
59		return cls, nil
60	}
61	return cls, cerr
62
63}
64
65var xCharsetConverterGetNumFallbacks func(uintptr) uint
66
67// Gets the number of fallbacks that @converter has applied so far.
68func (x *CharsetConverter) GetNumFallbacks() uint {
69
70	cret := xCharsetConverterGetNumFallbacks(x.GoPointer())
71	return cret
72}
73
74var xCharsetConverterGetUseFallback func(uintptr) bool
75
76// Gets the #GCharsetConverter:use-fallback property.
77func (x *CharsetConverter) GetUseFallback() bool {
78
79	cret := xCharsetConverterGetUseFallback(x.GoPointer())
80	return cret
81}
82
83var xCharsetConverterSetUseFallback func(uintptr, bool)
84
85// Sets the #GCharsetConverter:use-fallback property.
86func (x *CharsetConverter) SetUseFallback(UseFallbackVar bool) {
87
88	xCharsetConverterSetUseFallback(x.GoPointer(), UseFallbackVar)
89
90}
91
92func (c *CharsetConverter) GoPointer() uintptr {
93	if c == nil {
94		return 0
95	}
96	return c.Ptr
97}
98
99func (c *CharsetConverter) SetGoPointer(ptr uintptr) {
100	c.Ptr = ptr
101}
102
103// SetPropertyFromCharset sets the "from-charset" property.
104// The character encoding to convert from.
105func (x *CharsetConverter) SetPropertyFromCharset(value string) {
106	var v gobject.Value
107	v.Init(gobject.TypeStringVal)
108	v.SetString(&value)
109	x.SetProperty("from-charset", &v)
110}
111
112// GetPropertyFromCharset gets the "from-charset" property.
113// The character encoding to convert from.
114func (x *CharsetConverter) GetPropertyFromCharset() string {
115	var v gobject.Value
116	x.GetProperty("from-charset", &v)
117	return v.GetString()
118}
119
120// SetPropertyToCharset sets the "to-charset" property.
121// The character encoding to convert to.
122func (x *CharsetConverter) SetPropertyToCharset(value string) {
123	var v gobject.Value
124	v.Init(gobject.TypeStringVal)
125	v.SetString(&value)
126	x.SetProperty("to-charset", &v)
127}
128
129// GetPropertyToCharset gets the "to-charset" property.
130// The character encoding to convert to.
131func (x *CharsetConverter) GetPropertyToCharset() string {
132	var v gobject.Value
133	x.GetProperty("to-charset", &v)
134	return v.GetString()
135}
136
137// SetPropertyUseFallback sets the "use-fallback" property.
138// Use fallback (of form `\<hexval>`) for invalid bytes.
139func (x *CharsetConverter) SetPropertyUseFallback(value bool) {
140	var v gobject.Value
141	v.Init(gobject.TypeBooleanVal)
142	v.SetBoolean(value)
143	x.SetProperty("use-fallback", &v)
144}
145
146// GetPropertyUseFallback gets the "use-fallback" property.
147// Use fallback (of form `\<hexval>`) for invalid bytes.
148func (x *CharsetConverter) GetPropertyUseFallback() bool {
149	var v gobject.Value
150	x.GetProperty("use-fallback", &v)
151	return v.GetBoolean()
152}
153
154// This is the main operation used when converting data. It is to be called
155// multiple times in a loop, and each time it will do some work, i.e.
156// producing some output (in @outbuf) or consuming some input (from @inbuf) or
157// both. If its not possible to do any work an error is returned.
158//
159// Note that a single call may not consume all input (or any input at all).
160// Also a call may produce output even if given no input, due to state stored
161// in the converter producing output.
162//
163// If any data was either produced or consumed, and then an error happens, then
164// only the successful conversion is reported and the error is returned on the
165// next call.
166//
167// A full conversion loop involves calling this method repeatedly, each time
168// giving it new input and space output space. When there is no more input
169// data after the data in @inbuf, the flag %G_CONVERTER_INPUT_AT_END must be set.
170// The loop will be (unless some error happens) returning %G_CONVERTER_CONVERTED
171// each time until all data is consumed and all output is produced, then
172// %G_CONVERTER_FINISHED is returned instead. Note, that %G_CONVERTER_FINISHED
173// may be returned even if %G_CONVERTER_INPUT_AT_END is not set, for instance
174// in a decompression converter where the end of data is detectable from the
175// data (and there might even be other data after the end of the compressed data).
176//
177// When some data has successfully been converted @bytes_read and is set to
178// the number of bytes read from @inbuf, and @bytes_written is set to indicate
179// how many bytes was written to @outbuf. If there are more data to output
180// or consume (i.e. unless the %G_CONVERTER_INPUT_AT_END is specified) then
181// %G_CONVERTER_CONVERTED is returned, and if no more data is to be output
182// then %G_CONVERTER_FINISHED is returned.
183//
184// On error %G_CONVERTER_ERROR is returned and @error is set accordingly.
185// Some errors need special handling:
186//
187// %G_IO_ERROR_NO_SPACE is returned if there is not enough space
188// to write the resulting converted data, the application should
189// call the function again with a larger @outbuf to continue.
190//
191// %G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough
192// input to fully determine what the conversion should produce,
193// and the %G_CONVERTER_INPUT_AT_END flag is not set. This happens for
194// example with an incomplete multibyte sequence when converting text,
195// or when a regexp matches up to the end of the input (and may match
196// further input). It may also happen when @inbuf_size is zero and
197// there is no more data to produce.
198//
199// When this happens the application should read more input and then
200// call the function again. If further input shows that there is no
201// more data call the function again with the same data but with
202// the %G_CONVERTER_INPUT_AT_END flag set. This may cause the conversion
203// to finish as e.g. in the regexp match case (or, to fail again with
204// %G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion where the
205// input is actually partial).
206//
207// After g_converter_convert() has returned %G_CONVERTER_FINISHED the
208// converter object is in an invalid state where its not allowed
209// to call g_converter_convert() anymore. At this time you can only
210// free the object or call g_converter_reset() to reset it to the
211// initial state.
212//
213// If the flag %G_CONVERTER_FLUSH is set then conversion is modified
214// to try to write out all internal state to the output. The application
215// has to call the function multiple times with the flag set, and when
216// the available input has been consumed and all internal state has
217// been produced then %G_CONVERTER_FLUSHED (or %G_CONVERTER_FINISHED if
218// really at the end) is returned instead of %G_CONVERTER_CONVERTED.
219// This is somewhat similar to what happens at the end of the input stream,
220// but done in the middle of the data.
221//
222// This has different meanings for different conversions. For instance
223// in a compression converter it would mean that we flush all the
224// compression state into output such that if you uncompress the
225// compressed data you get back all the input data. Doing this may
226// make the final file larger due to padding though. Another example
227// is a regexp conversion, where if you at the end of the flushed data
228// have a match, but there is also a potential longer match. In the
229// non-flushed case we would ask for more input, but when flushing we
230// treat this as the end of input and do the match.
231//
232// Flushing is not always possible (like if a charset converter flushes
233// at a partial multibyte sequence). Converters are supposed to try
234// to produce as much output as possible and then return an error
235// (typically %G_IO_ERROR_PARTIAL_INPUT).
236func (x *CharsetConverter) Convert(InbufVar []byte, InbufSizeVar uint, OutbufVar []byte, OutbufSizeVar uint, FlagsVar ConverterFlags, BytesReadVar *uint, BytesWrittenVar *uint) (ConverterResult, error) {
237	var cerr *glib.Error
238
239	cret := XGConverterConvert(x.GoPointer(), InbufVar, InbufSizeVar, OutbufVar, OutbufSizeVar, FlagsVar, BytesReadVar, BytesWrittenVar, &cerr)
240	if cerr == nil {
241		return cret, nil
242	}
243	return cret, cerr
244
245}
246
247// Applies @converter to the data in @bytes.
248func (x *CharsetConverter) ConvertBytes(BytesVar *glib.Bytes) (*glib.Bytes, error) {
249	var cerr *glib.Error
250
251	cret := XGConverterConvertBytes(x.GoPointer(), BytesVar, &cerr)
252	if cerr == nil {
253		return cret, nil
254	}
255	return cret, cerr
256
257}
258
259// Resets all internal state in the converter, making it behave
260// as if it was just created. If the converter has any internal
261// state that would produce output then that output is lost.
262func (x *CharsetConverter) Reset() {
263
264	XGConverterReset(x.GoPointer())
265
266}
267
268// Initializes the object implementing the interface.
269//
270// This method is intended for language bindings. If writing in C,
271// g_initable_new() should typically be used instead.
272//
273// The object must be initialized before any real use after initial
274// construction, either with this function or g_async_initable_init_async().
275//
276// Implementations may also support cancellation. If @cancellable is not %NULL,
277// then initialization can be cancelled by triggering the cancellable object
278// from another thread. If the operation was cancelled, the error
279// %G_IO_ERROR_CANCELLED will be returned. If @cancellable is not %NULL and
280// the object doesn't support cancellable initialization the error
281// %G_IO_ERROR_NOT_SUPPORTED will be returned.
282//
283// If the object is not initialized, or initialization returns with an
284// error, then all operations on the object except g_object_ref() and
285// g_object_unref() are considered to be invalid, and have undefined
286// behaviour. See the [description][iface@Gio.Initable#description] for more details.
287//
288// Callers should not assume that a class which implements #GInitable can be
289// initialized multiple times, unless the class explicitly documents itself as
290// supporting this. Generally, a class’ implementation of init() can assume
291// (and assert) that it will only be called once. Previously, this documentation
292// recommended all #GInitable implementations should be idempotent; that
293// recommendation was relaxed in GLib 2.54.
294//
295// If a class explicitly supports being initialized multiple times, it is
296// recommended that the method is idempotent: multiple calls with the same
297// arguments should return the same results. Only the first call initializes
298// the object; further calls return the result of the first call.
299//
300// One reason why a class might need to support idempotent initialization is if
301// it is designed to be used via the singleton pattern, with a
302// #GObjectClass.constructor that sometimes returns an existing instance.
303// In this pattern, a caller would expect to be able to call g_initable_init()
304// on the result of g_object_new(), regardless of whether it is in fact a new
305// instance.
306func (x *CharsetConverter) Init(CancellableVar *Cancellable) (bool, error) {
307	var cerr *glib.Error
308
309	cret := XGInitableInit(x.GoPointer(), CancellableVar.GoPointer(), &cerr)
310	if cerr == nil {
311		return cret, nil
312	}
313	return cret, cerr
314
315}
316
317func init() {
318	core.SetPackageName("GIO", "gio-2.0")
319	core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
320	var libs []uintptr
321	for _, libPath := range core.GetPaths("GIO") {
322		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
323		if err != nil {
324			panic(err)
325		}
326		libs = append(libs, lib)
327	}
328
329	core.PuregoSafeRegister(&xCharsetConverterGLibType, libs, "g_charset_converter_get_type")
330
331	core.PuregoSafeRegister(&xNewCharsetConverter, libs, "g_charset_converter_new")
332
333	core.PuregoSafeRegister(&xCharsetConverterGetNumFallbacks, libs, "g_charset_converter_get_num_fallbacks")
334	core.PuregoSafeRegister(&xCharsetConverterGetUseFallback, libs, "g_charset_converter_get_use_fallback")
335	core.PuregoSafeRegister(&xCharsetConverterSetUseFallback, libs, "g_charset_converter_set_use_fallback")
336
337}

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