mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 18:15:28 +00:00
6ec923833e
* generator/Signal.cs : use ValueArray to assemble parms arg for g_signal_chain_from_overriden call. Initialize retval GValue for above. * glib/Object.cs : g_signal_chain_from_overridden parms are IntPtrs. * glib/TypeConverter.cs : handle unboxed ValueTypes. * glib/Value.cs : handle unboxed struct types. add ctor for init'd unset Values. * glib/ValueArray.cs : new binding for GValueArray used by VMs. * glue/valuearray.c : field accessors * glue/Makefile.am : add new glue file * glue/makefile.win32 : add new glue file [Fixes #52680] svn path=/trunk/gtk-sharp/; revision=22069
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
// GLib.TypeConverter.cs : Convert between fundamental and .NET types
|
|
//
|
|
// Author: Rachel Hestilow <hestilow@ximian.com>
|
|
//
|
|
// (c) 2002 Rachel Hestilow
|
|
|
|
namespace GLibSharp {
|
|
using System;
|
|
using System.Collections;
|
|
using GLib;
|
|
|
|
/// <summary>
|
|
/// Fundamental type converter
|
|
/// </summary>
|
|
///
|
|
/// <remarks>
|
|
/// Utilities for converting between TypeFundamentals and System.Type
|
|
/// </remarks>
|
|
public class TypeConverter {
|
|
|
|
private TypeConverter () {}
|
|
|
|
public static GType LookupType (System.Type type)
|
|
{
|
|
if (type.Equals (typeof (string)))
|
|
return GType.String;
|
|
if (type.Equals (typeof (bool)))
|
|
return GType.Boolean;
|
|
if (type.Equals (typeof (int)))
|
|
return GType.Int;
|
|
if (type.Equals (typeof (double)))
|
|
return GType.Double;
|
|
if (type.Equals (typeof (float)))
|
|
return GType.Float;
|
|
if (type.Equals (typeof (char)))
|
|
return GType.Char;
|
|
if (type.Equals (typeof (uint)))
|
|
return GType.UInt;
|
|
if (type.IsValueType)
|
|
return GType.Pointer;
|
|
if (type.IsSubclassOf (typeof (GLib.Object)))
|
|
return GType.Object;
|
|
else if (type.IsSubclassOf (typeof (GLib.Boxed)))
|
|
return GType.Boxed;
|
|
else
|
|
return GType.None;
|
|
}
|
|
}
|
|
}
|
|
|