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

namespace JavaScript
{

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

	#region Autogenerated code

	public partial class Value : GLib.Object
	{

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

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _class_abi = null;

		static public new GLib.AbiStruct class_abi {
			get {
				if (_class_abi == null)
					_class_abi = new GLib.AbiStruct(new List<GLib.AbiField> {
						new GLib.AbiField("_jsc_reserved0"
							, GLib.Object.class_abi.Fields
							, (uint)Marshal.SizeOf(typeof(IntPtr)) // _jsc_reserved0
							, null
							, "_jsc_reserved1"
							, (uint)Marshal.SizeOf(typeof(IntPtr))
							, 0
						),
						new GLib.AbiField("_jsc_reserved1"
							, -1
							, (uint)Marshal.SizeOf(typeof(IntPtr)) // _jsc_reserved1
							, "_jsc_reserved0"
							, "_jsc_reserved2"
							, (uint)Marshal.SizeOf(typeof(IntPtr))
							, 0
						),
						new GLib.AbiField("_jsc_reserved2"
							, -1
							, (uint)Marshal.SizeOf(typeof(IntPtr)) // _jsc_reserved2
							, "_jsc_reserved1"
							, "_jsc_reserved3"
							, (uint)Marshal.SizeOf(typeof(IntPtr))
							, 0
						),
						new GLib.AbiField("_jsc_reserved3"
							, -1
							, (uint)Marshal.SizeOf(typeof(IntPtr)) // _jsc_reserved3
							, "_jsc_reserved2"
							, null
							, (uint)Marshal.SizeOf(typeof(IntPtr))
							, 0
						),
					});

				return _class_abi;
			}
		}

		// End of the ABI representation.

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_get_type();

		static d_jsc_value_get_type jsc_value_get_type = FuncLoader.LoadFunction<d_jsc_value_get_type>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_get_type"));

		public static new GLib.GType GType {
			get {
				IntPtr raw_ret = jsc_value_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_constructor_callv(IntPtr raw, uint n_parameters, IntPtr[] parameters);

		static d_jsc_value_constructor_callv jsc_value_constructor_callv = FuncLoader.LoadFunction<d_jsc_value_constructor_callv>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_constructor_callv"));

		public Value ConstructorCallv(Value[] parameters)
		{
			int cnt_parameters = parameters == null ? 0 : parameters.Length;
			IntPtr[] native_parameters = new IntPtr [cnt_parameters];

			for (int i = 0; i < cnt_parameters; i++)
				native_parameters[i] = parameters[i] == null ? IntPtr.Zero : parameters[i].Handle;

			IntPtr raw_ret = jsc_value_constructor_callv(Handle, (uint)(parameters == null ? 0 : parameters.Length), native_parameters);
			Value ret = GLib.Object.GetObject(raw_ret, true) as Value;

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_function_callv(IntPtr raw, uint n_parameters, IntPtr[] parameters);

		static d_jsc_value_function_callv jsc_value_function_callv = FuncLoader.LoadFunction<d_jsc_value_function_callv>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_function_callv"));

		public Value FunctionCallv(Value[] parameters)
		{
			int cnt_parameters = parameters == null ? 0 : parameters.Length;
			IntPtr[] native_parameters = new IntPtr [cnt_parameters];

			for (int i = 0; i < cnt_parameters; i++)
				native_parameters[i] = parameters[i] == null ? IntPtr.Zero : parameters[i].Handle;

			IntPtr raw_ret = jsc_value_function_callv(Handle, (uint)(parameters == null ? 0 : parameters.Length), native_parameters);
			Value ret = GLib.Object.GetObject(raw_ret, true) as Value;

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_array(IntPtr raw);

		static d_jsc_value_is_array jsc_value_is_array = FuncLoader.LoadFunction<d_jsc_value_is_array>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_array"));

		public bool IsArray {
			get {
				bool raw_ret = jsc_value_is_array(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_boolean(IntPtr raw);

		static d_jsc_value_is_boolean jsc_value_is_boolean = FuncLoader.LoadFunction<d_jsc_value_is_boolean>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_boolean"));

		public bool IsBoolean {
			get {
				bool raw_ret = jsc_value_is_boolean(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_constructor(IntPtr raw);

		static d_jsc_value_is_constructor jsc_value_is_constructor = FuncLoader.LoadFunction<d_jsc_value_is_constructor>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_constructor"));

		public bool IsConstructor {
			get {
				bool raw_ret = jsc_value_is_constructor(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_function(IntPtr raw);

		static d_jsc_value_is_function jsc_value_is_function = FuncLoader.LoadFunction<d_jsc_value_is_function>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_function"));

		public bool IsFunction {
			get {
				bool raw_ret = jsc_value_is_function(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_null(IntPtr raw);

		static d_jsc_value_is_null jsc_value_is_null = FuncLoader.LoadFunction<d_jsc_value_is_null>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_null"));

		public bool IsNull {
			get {
				bool raw_ret = jsc_value_is_null(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_number(IntPtr raw);

		static d_jsc_value_is_number jsc_value_is_number = FuncLoader.LoadFunction<d_jsc_value_is_number>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_number"));

		public bool IsNumber {
			get {
				bool raw_ret = jsc_value_is_number(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_object(IntPtr raw);

		static d_jsc_value_is_object jsc_value_is_object = FuncLoader.LoadFunction<d_jsc_value_is_object>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_object"));

		public bool IsObject {
			get {
				bool raw_ret = jsc_value_is_object(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_string(IntPtr raw);

		static d_jsc_value_is_string jsc_value_is_string = FuncLoader.LoadFunction<d_jsc_value_is_string>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_string"));

		public bool IsString {
			get {
				bool raw_ret = jsc_value_is_string(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_is_undefined(IntPtr raw);

		static d_jsc_value_is_undefined jsc_value_is_undefined = FuncLoader.LoadFunction<d_jsc_value_is_undefined>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_is_undefined"));

		public bool IsUndefined {
			get {
				bool raw_ret = jsc_value_is_undefined(Handle);
				bool ret = raw_ret;

				return ret;
			}
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_object_delete_property(IntPtr raw, IntPtr name);

		static d_jsc_value_object_delete_property jsc_value_object_delete_property = FuncLoader.LoadFunction<d_jsc_value_object_delete_property>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_delete_property"));

		public bool ObjectDeleteProperty(string name)
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
			bool raw_ret = jsc_value_object_delete_property(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free(native_name);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_object_enumerate_properties(IntPtr raw);

		static d_jsc_value_object_enumerate_properties jsc_value_object_enumerate_properties = FuncLoader.LoadFunction<d_jsc_value_object_enumerate_properties>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_enumerate_properties"));

		public string[] ObjectEnumerateProperties()
		{
			IntPtr raw_ret = jsc_value_object_enumerate_properties(Handle);
			string[] ret = GLib.Marshaller.NullTermPtrToStringArray(raw_ret, true);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_object_get_property(IntPtr raw, IntPtr name);

		static d_jsc_value_object_get_property jsc_value_object_get_property = FuncLoader.LoadFunction<d_jsc_value_object_get_property>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_get_property"));

		public Value ObjectGetProperty(string name)
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
			IntPtr raw_ret = jsc_value_object_get_property(Handle, native_name);
			Value ret = GLib.Object.GetObject(raw_ret, true) as Value;
			GLib.Marshaller.Free(native_name);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_object_get_property_at_index(IntPtr raw, uint index);

		static d_jsc_value_object_get_property_at_index jsc_value_object_get_property_at_index = FuncLoader.LoadFunction<d_jsc_value_object_get_property_at_index>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_get_property_at_index"));

		public Value ObjectGetPropertyAtIndex(uint index)
		{
			IntPtr raw_ret = jsc_value_object_get_property_at_index(Handle, index);
			Value ret = GLib.Object.GetObject(raw_ret, true) as Value;

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_object_has_property(IntPtr raw, IntPtr name);

		static d_jsc_value_object_has_property jsc_value_object_has_property = FuncLoader.LoadFunction<d_jsc_value_object_has_property>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_has_property"));

		public bool ObjectHasProperty(string name)
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
			bool raw_ret = jsc_value_object_has_property(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free(native_name);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_object_invoke_methodv(IntPtr raw, IntPtr name, uint n_parameters, IntPtr[] parameters);

		static d_jsc_value_object_invoke_methodv jsc_value_object_invoke_methodv = FuncLoader.LoadFunction<d_jsc_value_object_invoke_methodv>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_invoke_methodv"));

		public Value ObjectInvokeMethodv(string name, Value[] parameters)
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
			int cnt_parameters = parameters == null ? 0 : parameters.Length;
			IntPtr[] native_parameters = new IntPtr [cnt_parameters];

			for (int i = 0; i < cnt_parameters; i++)
				native_parameters[i] = parameters[i] == null ? IntPtr.Zero : parameters[i].Handle;

			IntPtr raw_ret = jsc_value_object_invoke_methodv(Handle, native_name, (uint)(parameters == null ? 0 : parameters.Length), native_parameters);
			Value ret = GLib.Object.GetObject(raw_ret, true) as Value;
			GLib.Marshaller.Free(native_name);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_object_is_instance_of(IntPtr raw, IntPtr name);

		static d_jsc_value_object_is_instance_of jsc_value_object_is_instance_of = FuncLoader.LoadFunction<d_jsc_value_object_is_instance_of>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_is_instance_of"));

		public bool ObjectIsInstanceOf(string name)
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
			bool raw_ret = jsc_value_object_is_instance_of(Handle, native_name);
			bool ret = raw_ret;
			GLib.Marshaller.Free(native_name);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate void d_jsc_value_object_set_property(IntPtr raw, IntPtr name, IntPtr property);

		static d_jsc_value_object_set_property jsc_value_object_set_property = FuncLoader.LoadFunction<d_jsc_value_object_set_property>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_set_property"));

		public void ObjectSetProperty(string name, Value property)
		{
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
			jsc_value_object_set_property(Handle, native_name, property == null ? IntPtr.Zero : property.Handle);
			GLib.Marshaller.Free(native_name);
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate void d_jsc_value_object_set_property_at_index(IntPtr raw, uint index, IntPtr property);

		static d_jsc_value_object_set_property_at_index jsc_value_object_set_property_at_index = FuncLoader.LoadFunction<d_jsc_value_object_set_property_at_index>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_object_set_property_at_index"));

		public void ObjectSetPropertyAtIndex(uint index, Value property)
		{
			jsc_value_object_set_property_at_index(Handle, index, property == null ? IntPtr.Zero : property.Handle);
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate bool d_jsc_value_to_boolean(IntPtr raw);

		static d_jsc_value_to_boolean jsc_value_to_boolean = FuncLoader.LoadFunction<d_jsc_value_to_boolean>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_to_boolean"));

		public bool ToBoolean()
		{
			bool raw_ret = jsc_value_to_boolean(Handle);
			bool ret = raw_ret;

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate double d_jsc_value_to_double(IntPtr raw);

		static d_jsc_value_to_double jsc_value_to_double = FuncLoader.LoadFunction<d_jsc_value_to_double>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_to_double"));

		public double ToDouble()
		{
			double raw_ret = jsc_value_to_double(Handle);
			double ret = raw_ret;

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate int d_jsc_value_to_int32(IntPtr raw);

		static d_jsc_value_to_int32 jsc_value_to_int32 = FuncLoader.LoadFunction<d_jsc_value_to_int32>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_to_int32"));

		public int ToInt32()
		{
			int raw_ret = jsc_value_to_int32(Handle);
			int ret = raw_ret;

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_to_json(IntPtr raw, uint indent);

		static d_jsc_value_to_json jsc_value_to_json = FuncLoader.LoadFunction<d_jsc_value_to_json>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_to_json"));

		public string ToJson(uint indent)
		{
			IntPtr raw_ret = jsc_value_to_json(Handle, indent);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_to_string(IntPtr raw);

		static d_jsc_value_to_string jsc_value_to_string = FuncLoader.LoadFunction<d_jsc_value_to_string>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_to_string"));

		public override string ToString()
		{
			IntPtr raw_ret = jsc_value_to_string(Handle);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);

			return ret;
		}

		[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
		delegate IntPtr d_jsc_value_to_string_as_bytes(IntPtr raw);

		static d_jsc_value_to_string_as_bytes jsc_value_to_string_as_bytes = FuncLoader.LoadFunction<d_jsc_value_to_string_as_bytes>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Webkit), "jsc_value_to_string_as_bytes"));

		public GLib.Bytes ToStringAsBytes()
		{
			IntPtr raw_ret = jsc_value_to_string_as_bytes(Handle);
			GLib.Bytes ret = new GLib.Bytes(raw_ret);

			return ret;
		}

		static bool initialized = false;
		static Value()
		{
			GtkSharp.WebkitGtkSharp.ObjectManager.Initialize();
	
		}

		// Internal representation of the wrapped structure ABI.
		static GLib.AbiStruct _abi_info = null;

		static public new GLib.AbiStruct abi_info {
			get {
				if (_abi_info == null)
					_abi_info = new GLib.AbiStruct(new List<GLib.AbiField> {
						new GLib.AbiField("priv"
							, GLib.Object.abi_info.Fields
							, (uint)Marshal.SizeOf(typeof(IntPtr)) // priv
							, null
							, null
							, (uint)Marshal.SizeOf(typeof(IntPtr))
							, 0
						),
					});

				return _abi_info;
			}
		}

		// End of the ABI representation.

		#endregion

	}

}