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

namespace GLib {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;
	using static GLib.AbiStructExtension;

#region Autogenerated code
	public partial class ZlibDecompressor : GLib.Object, GLib.IConverter {

		public ZlibDecompressor (IntPtr raw) : base(raw) {}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_zlib_decompressor_new(int format);
		static d_g_zlib_decompressor_new g_zlib_decompressor_new = FuncLoader.LoadFunction<d_g_zlib_decompressor_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_zlib_decompressor_new"));

		public ZlibDecompressor (GLib.ZlibCompressorFormat format) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ZlibDecompressor)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("format");
				vals.Add (new GLib.Value (format));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_zlib_decompressor_new((int) format);
		}

		[GLib.Property ("format")]
		public GLib.ZlibCompressorFormat Format {
			get {
				GLib.Value val = GetProperty ("format");
				GLib.ZlibCompressorFormat ret = (GLib.ZlibCompressorFormat) (Enum) val;
				val.Dispose ();
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_g_zlib_decompressor_get_file_info(IntPtr raw);
		static d_g_zlib_decompressor_get_file_info g_zlib_decompressor_get_file_info = FuncLoader.LoadFunction<d_g_zlib_decompressor_get_file_info>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_zlib_decompressor_get_file_info"));

		[GLib.Property ("file-info")]
		public GLib.FileInfo FileInfo {
			get  {
				IntPtr raw_ret = g_zlib_decompressor_get_file_info(Handle);
				GLib.FileInfo ret = GLib.Object.GetObject(raw_ret) as GLib.FileInfo;
				return ret;
			}
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;
		static public unsafe new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct (GLib.Object.class_abi.Fields);

				return _class_abi;
			}
		}


		// End of the ABI representation.

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

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = g_zlib_decompressor_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate int d_g_converter_convert(IntPtr raw, IntPtr inbuf, UIntPtr inbuf_size, IntPtr outbuf, UIntPtr outbuf_size, int flags, out UIntPtr bytes_read, out UIntPtr bytes_written, out IntPtr error);
		static d_g_converter_convert g_converter_convert = FuncLoader.LoadFunction<d_g_converter_convert>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_converter_convert"));

		public GLib.ConverterResult Convert(IntPtr inbuf, ulong inbuf_size, IntPtr outbuf, ulong outbuf_size, GLib.ConverterFlags flags, out ulong bytes_read, out ulong bytes_written) {
			UIntPtr native_bytes_read;
			UIntPtr native_bytes_written;
			IntPtr error = IntPtr.Zero;
			int raw_ret = g_converter_convert(Handle, inbuf, new UIntPtr (inbuf_size), outbuf, new UIntPtr (outbuf_size), (int) flags, out native_bytes_read, out native_bytes_written, out error);
			GLib.ConverterResult ret = (GLib.ConverterResult) raw_ret;
			bytes_read = (ulong) native_bytes_read;
			bytes_written = (ulong) native_bytes_written;
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}

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

		public void Reset() {
			g_converter_reset(Handle);
		}


		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;
		static public unsafe new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct (GLib.Object.abi_info.Fields);

				return _abi_info;
			}
		}


		// End of the ABI representation.

#endregion
	}
}
