// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT package gio import ( "structs" "unsafe" "github.com/ebitengine/purego" "github.com/bnema/puregotk/pkg/core" "github.com/bnema/puregotk/v4/glib" ) // `GStaticResource` is an opaque data structure and can only be accessed // using the following functions. type StaticResource struct { _ structs.HostLayout Data byte DataLen uint Resource *Resource Next *StaticResource Padding uintptr } func (x *StaticResource) GoPointer() uintptr { return uintptr(unsafe.Pointer(x)) } var xStaticResourceFini func(uintptr) // Finalizes a [struct@Gio.Resource] initialized by // [method@Gio.StaticResource.init]. // // This is normally used by code generated by // [`glib-compile-resources`](glib-compile-resources.html) // and is not typically used by other code. func (x *StaticResource) Fini() { xStaticResourceFini(x.GoPointer()) } var xStaticResourceGetResource func(uintptr) *Resource // Gets the [struct@Gio.Resource] that was registered by a call to // [method@Gio.StaticResource.init]. // // This is normally used by code generated by // [`glib-compile-resources`](glib-compile-resources.html) // and is not typically used by other code. func (x *StaticResource) GetResource() *Resource { cret := xStaticResourceGetResource(x.GoPointer()) return cret } var xStaticResourceInit func(uintptr) // Initializes a [struct@Gio.Resource] from static data using a // [struct@Gio.StaticResource]. // // This is normally used by code generated by // [`glib-compile-resources`](glib-compile-resources.html) // and is not typically used by other code. func (x *StaticResource) Init() { xStaticResourceInit(x.GoPointer()) } var xResourceErrorQuark func() glib.Quark // Gets the [struct@Gio.Resource] Error Quark. func ResourceErrorQuark() glib.Quark { cret := xResourceErrorQuark() return cret } var xResourceLoad func(string, **glib.Error) *Resource // Loads a binary resource bundle and creates a [struct@Gio.Resource] // representation of it, allowing you to query it for data. // // If you want to use this resource in the global resource namespace you need // to register it with [func@Gio.resources_register]. // // If @filename is empty or the data in it is corrupt, // %G_RESOURCE_ERROR_INTERNAL will be returned. If @filename doesn’t exist, or // there is an error in reading it, an error from [ctor@GLib.MappedFile.new] // will be returned. func ResourceLoad(FilenameVar string) (*Resource, error) { var cerr *glib.Error cret := xResourceLoad(FilenameVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xResourcesEnumerateChildren func(string, ResourceLookupFlags, **glib.Error) []string // Returns all the names of children at the specified @path in the set of // globally registered resources. // // The return result is a `NULL` terminated list of strings which should // be released with [func@GLib.strfreev]. // // @lookup_flags controls the behaviour of the lookup. func ResourcesEnumerateChildren(PathVar string, LookupFlagsVar ResourceLookupFlags) ([]string, error) { var cerr *glib.Error cret := xResourcesEnumerateChildren(PathVar, LookupFlagsVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xResourcesGetInfo func(string, ResourceLookupFlags, *uint, *uint32, **glib.Error) bool // Looks for a file at the specified @path in the set of // globally registered resources and if found returns information about it. // // @lookup_flags controls the behaviour of the lookup. func ResourcesGetInfo(PathVar string, LookupFlagsVar ResourceLookupFlags, SizeVar *uint, FlagsVar *uint32) (bool, error) { var cerr *glib.Error cret := xResourcesGetInfo(PathVar, LookupFlagsVar, SizeVar, FlagsVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xResourcesHasChildren func(string) bool // Returns whether the specified @path in the set of // globally registered resources has children. func ResourcesHasChildren(PathVar string) bool { cret := xResourcesHasChildren(PathVar) return cret } var xResourcesLookupData func(string, ResourceLookupFlags, **glib.Error) *glib.Bytes // Looks for a file at the specified @path in the set of // globally registered resources and returns a [struct@GLib.Bytes] that // lets you directly access the data in memory. // // The data is always followed by a zero byte, so you // can safely use the data as a C string. However, that byte // is not included in the size of the [struct@GLib.Bytes]. // // For uncompressed resource files this is a pointer directly into // the resource bundle, which is typically in some read-only data section // in the program binary. For compressed files we allocate memory on // the heap and automatically uncompress the data. // // @lookup_flags controls the behaviour of the lookup. func ResourcesLookupData(PathVar string, LookupFlagsVar ResourceLookupFlags) (*glib.Bytes, error) { var cerr *glib.Error cret := xResourcesLookupData(PathVar, LookupFlagsVar, &cerr) if cerr == nil { return cret, nil } return cret, cerr } var xResourcesOpenStream func(string, ResourceLookupFlags, **glib.Error) uintptr // Looks for a file at the specified @path in the set of // globally registered resources and returns a [class@Gio.InputStream] // that lets you read the data. // // @lookup_flags controls the behaviour of the lookup. func ResourcesOpenStream(PathVar string, LookupFlagsVar ResourceLookupFlags) (*InputStream, error) { var cls *InputStream var cerr *glib.Error cret := xResourcesOpenStream(PathVar, LookupFlagsVar, &cerr) if cret == 0 { return nil, cerr } cls = &InputStream{} cls.Ptr = cret if cerr == nil { return cls, nil } return cls, cerr } var xResourcesRegister func(*Resource) // Registers the resource with the process-global set of resources. // // Once a resource is registered the files in it can be accessed // with the global resource lookup functions like // [func@Gio.resources_lookup_data]. func ResourcesRegister(ResourceVar *Resource) { xResourcesRegister(ResourceVar) } var xResourcesUnregister func(*Resource) // Unregisters the resource from the process-global set of resources. func ResourcesUnregister(ResourceVar *Resource) { xResourcesUnregister(ResourceVar) } func init() { core.SetPackageName("GIO", "gio-2.0") core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"}) var libs []uintptr for _, libPath := range core.GetPaths("GIO") { lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL) if err != nil { panic(err) } libs = append(libs, lib) } core.PuregoSafeRegister(&xResourceErrorQuark, libs, "g_resource_error_quark") core.PuregoSafeRegister(&xResourceLoad, libs, "g_resource_load") core.PuregoSafeRegister(&xResourcesEnumerateChildren, libs, "g_resources_enumerate_children") core.PuregoSafeRegister(&xResourcesGetInfo, libs, "g_resources_get_info") core.PuregoSafeRegister(&xResourcesHasChildren, libs, "g_resources_has_children") core.PuregoSafeRegister(&xResourcesLookupData, libs, "g_resources_lookup_data") core.PuregoSafeRegister(&xResourcesOpenStream, libs, "g_resources_open_stream") core.PuregoSafeRegister(&xResourcesRegister, libs, "g_resources_register") core.PuregoSafeRegister(&xResourcesUnregister, libs, "g_resources_unregister") core.PuregoSafeRegister(&xStaticResourceFini, libs, "g_static_resource_fini") core.PuregoSafeRegister(&xStaticResourceGetResource, libs, "g_static_resource_get_resource") core.PuregoSafeRegister(&xStaticResourceInit, libs, "g_static_resource_init") }