// 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 SocketConnectableAdapter : GLib.GInterfaceAdapter, GLib.ISocketConnectable { [StructLayout (LayoutKind.Sequential)] struct GSocketConnectableIface { public EnumerateNativeDelegate Enumerate; public ProxyEnumerateNativeDelegate ProxyEnumerate; public ToStringNativeDelegate ToString; } static GSocketConnectableIface iface; static SocketConnectableAdapter () { GLib.GType.Register (_gtype, typeof (SocketConnectableAdapter)); iface.Enumerate = new EnumerateNativeDelegate (Enumerate_cb); iface.ProxyEnumerate = new ProxyEnumerateNativeDelegate (ProxyEnumerate_cb); iface.ToString = new ToStringNativeDelegate (ToString_cb); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr EnumerateNativeDelegate (IntPtr inst); static IntPtr Enumerate_cb (IntPtr inst) { try { ISocketConnectableImplementor __obj = GLib.Object.GetObject (inst, false) as ISocketConnectableImplementor; GLib.SocketAddressEnumerator __result; __result = __obj.Enumerate (); return __result == null ? IntPtr.Zero : __result.Handle; } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw; } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr ProxyEnumerateNativeDelegate (IntPtr inst); static IntPtr ProxyEnumerate_cb (IntPtr inst) { try { ISocketConnectableImplementor __obj = GLib.Object.GetObject (inst, false) as ISocketConnectableImplementor; GLib.SocketAddressEnumerator __result; __result = __obj.ProxyEnumerate (); return __result == null ? IntPtr.Zero : __result.Handle; } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw; } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr ToStringNativeDelegate (IntPtr inst); static IntPtr ToString_cb (IntPtr inst) { try { ISocketConnectableImplementor __obj = GLib.Object.GetObject (inst, false) as ISocketConnectableImplementor; string __result; __result = __obj.ToString (); return GLib.Marshaller.StringToPtrGStrdup(__result); } catch (Exception e) { GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw; } } static int class_offset = 2 * IntPtr.Size; static void Initialize (IntPtr ptr, IntPtr data) { IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset); GSocketConnectableIface native_iface = (GSocketConnectableIface) Marshal.PtrToStructure (ifaceptr, typeof (GSocketConnectableIface)); native_iface.Enumerate = iface.Enumerate; native_iface.ProxyEnumerate = iface.ProxyEnumerate; native_iface.ToString = iface.ToString; Marshal.StructureToPtr (native_iface, ifaceptr, false); } GLib.Object implementor; public SocketConnectableAdapter () { InitHandler = new GLib.GInterfaceInitHandler (Initialize); } public SocketConnectableAdapter (ISocketConnectableImplementor implementor) { if (implementor == null) throw new ArgumentNullException ("implementor"); else if (!(implementor is GLib.Object)) throw new ArgumentException ("implementor must be a subclass of GLib.Object"); this.implementor = implementor as GLib.Object; } public SocketConnectableAdapter (IntPtr handle) { if (!_gtype.IsInstance (handle)) throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle"); implementor = GLib.Object.GetObject (handle); } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr d_g_socket_connectable_get_type(); static d_g_socket_connectable_get_type g_socket_connectable_get_type = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_socket_connectable_get_type")); private static GLib.GType _gtype = new GLib.GType (g_socket_connectable_get_type ()); public static GLib.GType GType { get { return _gtype; } } public override GLib.GType GInterfaceGType { get { return _gtype; } } public override IntPtr Handle { get { return implementor.Handle; } } public IntPtr OwnedHandle { get { return implementor.OwnedHandle; } } public static ISocketConnectable GetObject (IntPtr handle, bool owned) { GLib.Object obj = GLib.Object.GetObject (handle, owned); return GetObject (obj); } public static ISocketConnectable GetObject (GLib.Object obj) { if (obj == null) return null; else if (obj is ISocketConnectableImplementor) return new SocketConnectableAdapter (obj as ISocketConnectableImplementor); else if (obj as ISocketConnectable == null) return new SocketConnectableAdapter (obj.Handle); else return obj as ISocketConnectable; } public ISocketConnectableImplementor Implementor { get { return implementor as ISocketConnectableImplementor; } } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr d_g_socket_connectable_enumerate(IntPtr raw); static d_g_socket_connectable_enumerate g_socket_connectable_enumerate = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_socket_connectable_enumerate")); public GLib.SocketAddressEnumerator Enumerate() { IntPtr raw_ret = g_socket_connectable_enumerate(Handle); GLib.SocketAddressEnumerator ret = GLib.Object.GetObject(raw_ret) as GLib.SocketAddressEnumerator; return ret; } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr d_g_socket_connectable_proxy_enumerate(IntPtr raw); static d_g_socket_connectable_proxy_enumerate g_socket_connectable_proxy_enumerate = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_socket_connectable_proxy_enumerate")); public GLib.SocketAddressEnumerator ProxyEnumerate() { IntPtr raw_ret = g_socket_connectable_proxy_enumerate(Handle); GLib.SocketAddressEnumerator ret = GLib.Object.GetObject(raw_ret) as GLib.SocketAddressEnumerator; return ret; } [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr d_g_socket_connectable_to_string(IntPtr raw); static d_g_socket_connectable_to_string g_socket_connectable_to_string = FuncLoader.LoadFunction(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gio), "g_socket_connectable_to_string")); public override string ToString() { IntPtr raw_ret = g_socket_connectable_to_string(Handle); string ret = GLib.Marshaller.PtrToStringGFree(raw_ret); return ret; } #endregion } }