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

namespace WebKit {

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Runtime.InteropServices;

#region Autogenerated code
	[StructLayout(LayoutKind.Sequential)]
	public partial struct SecurityOrigin : IEquatable<SecurityOrigin> {


		public static WebKit.SecurityOrigin Zero = new WebKit.SecurityOrigin ();

		public static WebKit.SecurityOrigin New(IntPtr raw) {
			if (raw == IntPtr.Zero)
				return WebKit.SecurityOrigin.Zero;
			return (WebKit.SecurityOrigin) Marshal.PtrToStructure (raw, typeof (WebKit.SecurityOrigin));
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_security_origin_new(IntPtr protocol, IntPtr host, ushort port);
		static d_webkit_security_origin_new webkit_security_origin_new = FuncLoader.LoadFunction<d_webkit_security_origin_new>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_security_origin_new"));

		public static SecurityOrigin New(string protocol, string host, ushort port)
		{
			IntPtr native_protocol = GLib.Marshaller.StringToPtrGStrdup (protocol);
			IntPtr native_host = GLib.Marshaller.StringToPtrGStrdup (host);
			SecurityOrigin result = SecurityOrigin.New (webkit_security_origin_new(native_protocol, native_host, port));
			GLib.Marshaller.Free (native_protocol);
			GLib.Marshaller.Free (native_host);
			return result;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_security_origin_new_for_uri(IntPtr uri);
		static d_webkit_security_origin_new_for_uri webkit_security_origin_new_for_uri = FuncLoader.LoadFunction<d_webkit_security_origin_new_for_uri>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_security_origin_new_for_uri"));

		public static SecurityOrigin NewForUri(string uri)
		{
			IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
			SecurityOrigin result = SecurityOrigin.New (webkit_security_origin_new_for_uri(native_uri));
			GLib.Marshaller.Free (native_uri);
			return result;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_webkit_security_origin_get_type();
		static d_webkit_security_origin_get_type webkit_security_origin_get_type = FuncLoader.LoadFunction<d_webkit_security_origin_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_security_origin_get_type"));

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

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

		public string Host { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				IntPtr raw_ret = webkit_security_origin_get_host(this_as_native);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate ushort d_webkit_security_origin_get_port(IntPtr raw);
		static d_webkit_security_origin_get_port webkit_security_origin_get_port = FuncLoader.LoadFunction<d_webkit_security_origin_get_port>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_security_origin_get_port"));

		public ushort Port { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				ushort raw_ret = webkit_security_origin_get_port(this_as_native);
				ushort ret = raw_ret;
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

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

		public string Protocol { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				IntPtr raw_ret = webkit_security_origin_get_protocol(this_as_native);
				string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_webkit_security_origin_is_opaque(IntPtr raw);
		static d_webkit_security_origin_is_opaque webkit_security_origin_is_opaque = FuncLoader.LoadFunction<d_webkit_security_origin_is_opaque>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "webkit_security_origin_is_opaque"));

		[Obsolete]
		public bool IsOpaque { 
			get {
				IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
				System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
				bool raw_ret = webkit_security_origin_is_opaque(this_as_native);
				bool ret = raw_ret;
				ReadNative (this_as_native, ref this);
				System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
				return ret;
			}
		}

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

		public WebKit.SecurityOrigin Ref() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr raw_ret = webkit_security_origin_ref(this_as_native);
			WebKit.SecurityOrigin ret = WebKit.SecurityOrigin.New (raw_ret);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public override string ToString() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			IntPtr raw_ret = webkit_security_origin_to_string(this_as_native);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
			return ret;
		}

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

		public void Unref() {
			IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf<WebKit.SecurityOrigin>());
			System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
			webkit_security_origin_unref(this_as_native);
			ReadNative (this_as_native, ref this);
			System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
		}

		static void ReadNative (IntPtr native, ref WebKit.SecurityOrigin target)
		{
			target = New (native);
		}

		public bool Equals (SecurityOrigin other)
		{
			return true;
		}

		public override bool Equals (object other)
		{
			return other is SecurityOrigin && Equals ((SecurityOrigin) other);
		}

		public override int GetHashCode ()
		{
			return this.GetType ().FullName.GetHashCode ();
		}

		public static explicit operator GLib.Value (WebKit.SecurityOrigin boxed)
		{
			GLib.Value val = GLib.Value.Empty;
			val.Init (WebKit.SecurityOrigin.GType);
			val.Val = boxed;
			return val;
		}

		public static explicit operator WebKit.SecurityOrigin (GLib.Value val)
		{
			return (WebKit.SecurityOrigin) val.Val;
		}
#endregion
	}
}
