// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace GLib {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class Resources {

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_resources_enumerate_children(IntPtr path, int lookup_flags, out IntPtr error);
		static d_g_resources_enumerate_children g_resources_enumerate_children = FuncLoader.LoadFunction<d_g_resources_enumerate_children>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resources_enumerate_children"));

		public static unsafe string EnumerateChildren(string path, GLib.ResourceLookupFlags lookup_flags) {
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resources_enumerate_children(native_path, (int) lookup_flags, out error);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			GLib.Marshaller.Free (native_path);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_g_resources_get_info(IntPtr path, int lookup_flags, out UIntPtr size, out uint flags, out IntPtr error);
		static d_g_resources_get_info g_resources_get_info = FuncLoader.LoadFunction<d_g_resources_get_info>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resources_get_info"));

		public static unsafe bool GetInfo(string path, GLib.ResourceLookupFlags lookup_flags, out ulong size, out uint flags) {
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			UIntPtr native_size;
			IntPtr error = IntPtr.Zero;
			bool raw_ret = g_resources_get_info(native_path, (int) lookup_flags, out native_size, out flags, out error);
			bool ret = raw_ret;
			GLib.Marshaller.Free (native_path);
			size = (ulong) native_size;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_resources_lookup_data(IntPtr path, int lookup_flags, out IntPtr error);
		static d_g_resources_lookup_data g_resources_lookup_data = FuncLoader.LoadFunction<d_g_resources_lookup_data>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resources_lookup_data"));

		public static unsafe GLib.Bytes LookupData(string path, GLib.ResourceLookupFlags lookup_flags) {
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resources_lookup_data(native_path, (int) lookup_flags, out error);
			GLib.Bytes ret = new GLib.Bytes(raw_ret);
			GLib.Marshaller.Free (native_path);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_resources_open_stream(IntPtr path, int lookup_flags, out IntPtr error);
		static d_g_resources_open_stream g_resources_open_stream = FuncLoader.LoadFunction<d_g_resources_open_stream>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resources_open_stream"));

		public static unsafe GLib.InputStream OpenStream(string path, GLib.ResourceLookupFlags lookup_flags) {
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_resources_open_stream(native_path, (int) lookup_flags, out error);
			GLib.InputStream ret = GLib.Object.GetObject(raw_ret) as GLib.InputStream;
			GLib.Marshaller.Free (native_path);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_resources_register(IntPtr resource);
		static d_g_resources_register g_resources_register = FuncLoader.LoadFunction<d_g_resources_register>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resources_register"));

		public static void Register(GLib.Resource resource) {
			g_resources_register(resource == null ? IntPtr.Zero : resource.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_g_resources_unregister(IntPtr resource);
		static d_g_resources_unregister g_resources_unregister = FuncLoader.LoadFunction<d_g_resources_unregister>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_resources_unregister"));

		public static void Unregister(GLib.Resource resource) {
			g_resources_unregister(resource == null ? IntPtr.Zero : resource.Handle);
		}

#endregion
	}
}
