diff --git a/ChangeLog b/ChangeLog index 94a6da395..74196e9d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-12-03 Jorge Garcia + + * glib/Type.cs: add Int64 and UInt64 support. + * glib/TypeConverter.cs: add Int64 and UInt64 support. + * glib/Value.cs: add Int64 and UInt64 support. + 2004-12-03 Mike Kestner * gtk/Dialog.custom : correct return value for AddButton overload. diff --git a/glib/Type.cs b/glib/Type.cs index 393636f0b..ea2e54a4f 100755 --- a/glib/Type.cs +++ b/glib/Type.cs @@ -39,6 +39,9 @@ namespace GLib { public static readonly GType String = new GType ((IntPtr) TypeFundamentals.TypeString); public static readonly GType Boolean = new GType ((IntPtr) TypeFundamentals.TypeBoolean); public static readonly GType Int = new GType ((IntPtr) TypeFundamentals.TypeInt); + public static readonly GType Int64 = new GType ((IntPtr) TypeFundamentals.TypeInt64); + public static readonly GType UInt64 = new GType ((IntPtr) TypeFundamentals.TypeUInt64); + public static readonly GType Double = new GType ((IntPtr) TypeFundamentals.TypeDouble); public static readonly GType Float = new GType ((IntPtr) TypeFundamentals.TypeFloat); public static readonly GType Char = new GType ((IntPtr) TypeFundamentals.TypeChar); diff --git a/glib/TypeConverter.cs b/glib/TypeConverter.cs index e8b92d44f..8bcd4d074 100644 --- a/glib/TypeConverter.cs +++ b/glib/TypeConverter.cs @@ -36,6 +36,10 @@ namespace GLib { return GType.Boolean; if (type.Equals (typeof (int))) return GType.Int; + if (type.Equals (typeof (long))) + return GType.Int64; + if (type.Equals (typeof (ulong))) + return GType.UInt64; if (type.Equals (typeof (double))) return GType.Double; if (type.Equals (typeof (float))) diff --git a/glib/Value.cs b/glib/Value.cs index efac2f7a5..409e96225 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -126,6 +126,23 @@ namespace GLib { g_value_set_int (ref this, val); } + [DllImport("libgobject-2.0-0.dll")] + static extern void g_value_set_int64 (ref Value val, long data); + + public Value (long val) : this (GType.Int64) + { + g_value_set_int64 (ref this, val); + } + + [DllImport("libgobject-2.0-0.dll")] + static extern void g_value_set_uint64 (ref Value val, ulong data); + + public Value (ulong val) : this (GType.UInt64) + { + g_value_set_uint64 (ref this, val); + } + + [DllImport("libgobject-2.0-0.dll")] static extern void g_value_set_object (ref Value val, IntPtr data); @@ -253,6 +270,23 @@ namespace GLib { return g_value_get_int (ref val); } + [DllImport("libgobject-2.0-0.dll")] + static extern long g_value_get_int64 (ref Value val); + + public static explicit operator long (Value val) + { + return g_value_get_int64 (ref val); + } + + [DllImport("libgobject-2.0-0.dll")] + static extern ulong g_value_get_uint64 (ref Value val); + + public static explicit operator ulong (Value val) + { + return g_value_get_uint64 (ref val); + } + + [DllImport("libgobject-2.0-0.dll")] static extern IntPtr g_value_get_object (ref Value val); @@ -334,6 +368,10 @@ namespace GLib { return (bool) this; else if (type == GType.Int) return (int) this; + else if (type == GType.Int64) + return (long) this; + else if (type == GType.UInt64) + return (ulong) this; else if (type == GType.Double) return (double) this; else if (type == GType.Float) @@ -358,6 +396,10 @@ namespace GLib { g_value_set_boolean (ref this, (bool) value); else if (type == GType.Int) g_value_set_int (ref this, (int) value); + else if (type == GType.Int64) + g_value_set_int64 (ref this, (long) value); + else if (type == GType.UInt64) + g_value_set_uint64 (ref this, (ulong) value); else if (type == GType.Double) g_value_set_double (ref this, (double) value); else if (type == GType.Float)